You've already forked flix
Throw away flix files in favor of a flix database
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
use seamantic::schema::sqlite_rowid_alias;
|
||||
|
||||
use sea_orm::sea_query;
|
||||
use sea_orm::sea_query::{Index, Table};
|
||||
use sea_orm::{DbErr, Iden};
|
||||
use sea_orm_migration::SchemaManager;
|
||||
use sea_orm_migration::schema::string;
|
||||
|
||||
#[derive(Iden)]
|
||||
pub enum FlixInfoCollections {
|
||||
Table,
|
||||
Id,
|
||||
Title,
|
||||
Overview,
|
||||
}
|
||||
|
||||
pub async fn up(manager: &SchemaManager<'_>) -> Result<(), DbErr> {
|
||||
manager
|
||||
.create_table(
|
||||
Table::create()
|
||||
.table(FlixInfoCollections::Table)
|
||||
.col(sqlite_rowid_alias(FlixInfoCollections::Id))
|
||||
.col(string(FlixInfoCollections::Title))
|
||||
.col(string(FlixInfoCollections::Overview))
|
||||
.to_owned(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
manager
|
||||
.create_index(
|
||||
Index::create()
|
||||
.name("idx-flix_info_collections-title")
|
||||
.table(FlixInfoCollections::Table)
|
||||
.col(FlixInfoCollections::Title)
|
||||
.to_owned(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn down(manager: &SchemaManager<'_>) -> Result<(), DbErr> {
|
||||
manager
|
||||
.drop_table(Table::drop().table(FlixInfoCollections::Table).to_owned())
|
||||
.await
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
use sea_orm::sea_query;
|
||||
use sea_orm::sea_query::{ForeignKeyCreateStatement, Index, Table};
|
||||
use sea_orm::{DbErr, Iden};
|
||||
use sea_orm_migration::SchemaManager;
|
||||
use sea_orm_migration::schema::{date, integer, string};
|
||||
|
||||
use crate::migration::m_000001::FlixInfoShows;
|
||||
|
||||
use super::FlixInfoSeasons;
|
||||
|
||||
#[derive(Iden)]
|
||||
pub enum FlixInfoEpisodes {
|
||||
Table,
|
||||
Show,
|
||||
Season,
|
||||
Episode,
|
||||
Title,
|
||||
Overview,
|
||||
Date,
|
||||
}
|
||||
|
||||
pub async fn up(manager: &SchemaManager<'_>) -> Result<(), DbErr> {
|
||||
manager
|
||||
.create_table(
|
||||
Table::create()
|
||||
.table(FlixInfoEpisodes::Table)
|
||||
.col(integer(FlixInfoEpisodes::Show))
|
||||
.col(integer(FlixInfoEpisodes::Season))
|
||||
.col(integer(FlixInfoEpisodes::Episode))
|
||||
.col(string(FlixInfoEpisodes::Title))
|
||||
.col(string(FlixInfoEpisodes::Overview))
|
||||
.col(date(FlixInfoEpisodes::Date))
|
||||
.primary_key(
|
||||
Index::create()
|
||||
.col(FlixInfoEpisodes::Show)
|
||||
.col(FlixInfoEpisodes::Season)
|
||||
.col(FlixInfoEpisodes::Episode),
|
||||
)
|
||||
.foreign_key(
|
||||
ForeignKeyCreateStatement::new()
|
||||
.name("fk-flix_info_episodes-show")
|
||||
.from_tbl(FlixInfoEpisodes::Table)
|
||||
.from_col(FlixInfoEpisodes::Show)
|
||||
.to_tbl(FlixInfoShows::Table)
|
||||
.to_col(FlixInfoShows::Id),
|
||||
)
|
||||
.foreign_key(
|
||||
ForeignKeyCreateStatement::new()
|
||||
.name("fk-flix_info_episodes-show_season")
|
||||
.from_tbl(FlixInfoEpisodes::Table)
|
||||
.from_col(FlixInfoEpisodes::Show)
|
||||
.from_col(FlixInfoEpisodes::Season)
|
||||
.to_tbl(FlixInfoSeasons::Table)
|
||||
.to_col(FlixInfoSeasons::Show)
|
||||
.to_col(FlixInfoSeasons::Season),
|
||||
)
|
||||
.to_owned(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn down(manager: &SchemaManager<'_>) -> Result<(), DbErr> {
|
||||
manager
|
||||
.drop_table(Table::drop().table(FlixInfoEpisodes::Table).to_owned())
|
||||
.await
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
use seamantic::schema::sqlite_rowid_alias;
|
||||
|
||||
use sea_orm::sea_query;
|
||||
use sea_orm::sea_query::{Index, Table};
|
||||
use sea_orm::{DbErr, Iden};
|
||||
use sea_orm_migration::SchemaManager;
|
||||
use sea_orm_migration::schema::{date, string};
|
||||
|
||||
#[derive(Iden)]
|
||||
pub enum FlixInfoMovies {
|
||||
Table,
|
||||
Id,
|
||||
Title,
|
||||
Tagline,
|
||||
Overview,
|
||||
Date,
|
||||
}
|
||||
|
||||
pub async fn up(manager: &SchemaManager<'_>) -> Result<(), DbErr> {
|
||||
manager
|
||||
.create_table(
|
||||
Table::create()
|
||||
.table(FlixInfoMovies::Table)
|
||||
.col(sqlite_rowid_alias(FlixInfoMovies::Id))
|
||||
.col(string(FlixInfoMovies::Title))
|
||||
.col(string(FlixInfoMovies::Tagline))
|
||||
.col(string(FlixInfoMovies::Overview))
|
||||
.col(date(FlixInfoMovies::Date))
|
||||
.to_owned(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
manager
|
||||
.create_index(
|
||||
Index::create()
|
||||
.name("idx-flix_info_movies-title")
|
||||
.table(FlixInfoMovies::Table)
|
||||
.col(FlixInfoMovies::Title)
|
||||
.to_owned(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
manager
|
||||
.create_index(
|
||||
Index::create()
|
||||
.name("idx-flix_info_movies-date")
|
||||
.table(FlixInfoMovies::Table)
|
||||
.col(FlixInfoMovies::Date)
|
||||
.to_owned(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn down(manager: &SchemaManager<'_>) -> Result<(), DbErr> {
|
||||
manager
|
||||
.drop_table(Table::drop().table(FlixInfoMovies::Table).to_owned())
|
||||
.await
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
use sea_orm::sea_query;
|
||||
use sea_orm::sea_query::{ForeignKeyCreateStatement, Index, Table};
|
||||
use sea_orm::{DbErr, Iden};
|
||||
use sea_orm_migration::SchemaManager;
|
||||
use sea_orm_migration::schema::{date, integer, string};
|
||||
|
||||
use super::FlixInfoShows;
|
||||
|
||||
#[derive(Iden)]
|
||||
pub enum FlixInfoSeasons {
|
||||
Table,
|
||||
Show,
|
||||
Season,
|
||||
Title,
|
||||
Overview,
|
||||
Date,
|
||||
}
|
||||
|
||||
pub async fn up(manager: &SchemaManager<'_>) -> Result<(), DbErr> {
|
||||
manager
|
||||
.create_table(
|
||||
Table::create()
|
||||
.table(FlixInfoSeasons::Table)
|
||||
.col(integer(FlixInfoSeasons::Show))
|
||||
.col(integer(FlixInfoSeasons::Season))
|
||||
.col(string(FlixInfoSeasons::Title))
|
||||
.col(string(FlixInfoSeasons::Overview))
|
||||
.col(date(FlixInfoSeasons::Date))
|
||||
.primary_key(
|
||||
Index::create()
|
||||
.col(FlixInfoSeasons::Show)
|
||||
.col(FlixInfoSeasons::Season),
|
||||
)
|
||||
.foreign_key(
|
||||
ForeignKeyCreateStatement::new()
|
||||
.name("fk-flix_info_seasons-show")
|
||||
.from_tbl(FlixInfoSeasons::Table)
|
||||
.from_col(FlixInfoSeasons::Show)
|
||||
.to_tbl(FlixInfoShows::Table)
|
||||
.to_col(FlixInfoShows::Id),
|
||||
)
|
||||
.to_owned(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn down(manager: &SchemaManager<'_>) -> Result<(), DbErr> {
|
||||
manager
|
||||
.drop_table(Table::drop().table(FlixInfoSeasons::Table).to_owned())
|
||||
.await
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
use seamantic::schema::sqlite_rowid_alias;
|
||||
|
||||
use sea_orm::sea_query;
|
||||
use sea_orm::sea_query::{Index, Table};
|
||||
use sea_orm::{DbErr, Iden};
|
||||
use sea_orm_migration::SchemaManager;
|
||||
use sea_orm_migration::schema::{date, string};
|
||||
|
||||
#[derive(Iden)]
|
||||
pub enum FlixInfoShows {
|
||||
Table,
|
||||
Id,
|
||||
Title,
|
||||
Tagline,
|
||||
Overview,
|
||||
Date,
|
||||
}
|
||||
|
||||
pub async fn up(manager: &SchemaManager<'_>) -> Result<(), DbErr> {
|
||||
manager
|
||||
.create_table(
|
||||
Table::create()
|
||||
.table(FlixInfoShows::Table)
|
||||
.col(sqlite_rowid_alias(FlixInfoShows::Id))
|
||||
.col(string(FlixInfoShows::Title))
|
||||
.col(string(FlixInfoShows::Tagline))
|
||||
.col(string(FlixInfoShows::Overview))
|
||||
.col(date(FlixInfoShows::Date))
|
||||
.to_owned(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
manager
|
||||
.create_index(
|
||||
Index::create()
|
||||
.name("idx-flix_info_shows-title")
|
||||
.table(FlixInfoShows::Table)
|
||||
.col(FlixInfoShows::Title)
|
||||
.to_owned(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
manager
|
||||
.create_index(
|
||||
Index::create()
|
||||
.name("idx-flix_info_shows-date")
|
||||
.table(FlixInfoShows::Table)
|
||||
.col(FlixInfoShows::Date)
|
||||
.to_owned(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn down(manager: &SchemaManager<'_>) -> Result<(), DbErr> {
|
||||
manager
|
||||
.drop_table(Table::drop().table(FlixInfoShows::Table).to_owned())
|
||||
.await
|
||||
}
|
||||
Reference in New Issue
Block a user