You've already forked flix
Update dependencies and lints
This commit is contained in:
@@ -1,18 +1,22 @@
|
||||
//! Custom views for collections.
|
||||
|
||||
use sea_orm::prelude::*;
|
||||
use sea_orm::sea_query::Table;
|
||||
use sea_orm::{ConnectionTrait, DbBackend, Statement};
|
||||
use sea_orm::{DbBackend, Statement};
|
||||
use sea_orm_migration::prelude::*;
|
||||
|
||||
pub async fn up(manager: &SchemaManager<'_>) -> Result<(), DbErr> {
|
||||
/// # Errors
|
||||
/// Database operations can fail.
|
||||
pub(crate) async fn up(manager: &SchemaManager<'_>) -> Result<(), DbErr> {
|
||||
manager
|
||||
.drop_table(Table::drop().table("flix_watched_collections").to_owned())
|
||||
.await?;
|
||||
|
||||
manager
|
||||
_ = manager
|
||||
.get_connection()
|
||||
.execute_raw(Statement::from_string(
|
||||
DbBackend::Sqlite,
|
||||
r#"
|
||||
"
|
||||
CREATE VIEW flix_watched_collections AS
|
||||
WITH RECURSIVE
|
||||
watched_items AS (
|
||||
@@ -81,22 +85,24 @@ pub async fn up(manager: &SchemaManager<'_>) -> Result<(), DbErr> {
|
||||
)
|
||||
GROUP BY ci.parent_id, wi.user_id
|
||||
;
|
||||
"#,
|
||||
",
|
||||
))
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn down(manager: &SchemaManager<'_>) -> Result<(), DbErr> {
|
||||
manager
|
||||
/// # Errors
|
||||
/// Database operations can fail.
|
||||
pub(crate) async fn down(manager: &SchemaManager<'_>) -> Result<(), DbErr> {
|
||||
_ = manager
|
||||
.get_connection()
|
||||
.execute_raw(Statement::from_string(
|
||||
DbBackend::Sqlite,
|
||||
r#"
|
||||
"
|
||||
DROP VIEW flix_watched_collections
|
||||
;
|
||||
"#,
|
||||
",
|
||||
))
|
||||
.await?;
|
||||
|
||||
|
||||
@@ -11,10 +11,16 @@ mod collections;
|
||||
mod seasons;
|
||||
mod shows;
|
||||
|
||||
/// The migration entry point.
|
||||
#[derive(DeriveMigrationName)]
|
||||
pub(super) struct Migration;
|
||||
|
||||
#[async_trait::async_trait]
|
||||
#[expect(
|
||||
elided_lifetimes_in_paths,
|
||||
reason = "async_trait causes lifetimes to be strange"
|
||||
)]
|
||||
#[expect(clippy::missing_trait_methods, reason = "accept default methods")]
|
||||
impl MigrationTrait for Migration {
|
||||
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||
seasons::up(manager).await?;
|
||||
@@ -1,18 +1,22 @@
|
||||
//! Custom views for seasons.
|
||||
|
||||
use sea_orm::prelude::*;
|
||||
use sea_orm::sea_query::Table;
|
||||
use sea_orm::{ConnectionTrait, DbBackend, Statement};
|
||||
use sea_orm::{DbBackend, Statement};
|
||||
use sea_orm_migration::prelude::*;
|
||||
|
||||
pub async fn up(manager: &SchemaManager<'_>) -> Result<(), DbErr> {
|
||||
/// # Errors
|
||||
/// Database operations can fail.
|
||||
pub(crate) async fn up(manager: &SchemaManager<'_>) -> Result<(), DbErr> {
|
||||
manager
|
||||
.drop_table(Table::drop().table("flix_watched_seasons").to_owned())
|
||||
.await?;
|
||||
|
||||
manager
|
||||
_ = manager
|
||||
.get_connection()
|
||||
.execute_raw(Statement::from_string(
|
||||
DbBackend::Sqlite,
|
||||
r#"
|
||||
"
|
||||
CREATE VIEW flix_watched_seasons AS
|
||||
SELECT
|
||||
w.show_id,
|
||||
@@ -36,22 +40,24 @@ pub async fn up(manager: &SchemaManager<'_>) -> Result<(), DbErr> {
|
||||
)
|
||||
GROUP BY w.show_id, w.season_number, w.user_id
|
||||
;
|
||||
"#,
|
||||
",
|
||||
))
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn down(manager: &SchemaManager<'_>) -> Result<(), DbErr> {
|
||||
manager
|
||||
/// # Errors
|
||||
/// Database operations can fail.
|
||||
pub(crate) async fn down(manager: &SchemaManager<'_>) -> Result<(), DbErr> {
|
||||
_ = manager
|
||||
.get_connection()
|
||||
.execute_raw(Statement::from_string(
|
||||
DbBackend::Sqlite,
|
||||
r#"
|
||||
"
|
||||
DROP VIEW flix_watched_seasons
|
||||
;
|
||||
"#,
|
||||
",
|
||||
))
|
||||
.await?;
|
||||
|
||||
|
||||
@@ -1,18 +1,22 @@
|
||||
//! Custom views for shows.
|
||||
|
||||
use sea_orm::prelude::*;
|
||||
use sea_orm::sea_query::Table;
|
||||
use sea_orm::{ConnectionTrait, DbBackend, Statement};
|
||||
use sea_orm::{DbBackend, Statement};
|
||||
use sea_orm_migration::prelude::*;
|
||||
|
||||
pub async fn up(manager: &SchemaManager<'_>) -> Result<(), DbErr> {
|
||||
/// # Errors
|
||||
/// Database operations can fail.
|
||||
pub(crate) async fn up(manager: &SchemaManager<'_>) -> Result<(), DbErr> {
|
||||
manager
|
||||
.drop_table(Table::drop().table("flix_watched_shows").to_owned())
|
||||
.await?;
|
||||
|
||||
manager
|
||||
_ = manager
|
||||
.get_connection()
|
||||
.execute_raw(Statement::from_string(
|
||||
DbBackend::Sqlite,
|
||||
r#"
|
||||
"
|
||||
CREATE VIEW flix_watched_shows AS
|
||||
SELECT
|
||||
w.show_id as id,
|
||||
@@ -33,22 +37,24 @@ pub async fn up(manager: &SchemaManager<'_>) -> Result<(), DbErr> {
|
||||
)
|
||||
GROUP BY w.show_id, w.user_id
|
||||
;
|
||||
"#,
|
||||
",
|
||||
))
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn down(manager: &SchemaManager<'_>) -> Result<(), DbErr> {
|
||||
manager
|
||||
/// # Errors
|
||||
/// Database operations can fail.
|
||||
pub(crate) async fn down(manager: &SchemaManager<'_>) -> Result<(), DbErr> {
|
||||
_ = manager
|
||||
.get_connection()
|
||||
.execute_raw(Statement::from_string(
|
||||
DbBackend::Sqlite,
|
||||
r#"
|
||||
"
|
||||
DROP VIEW flix_watched_shows
|
||||
;
|
||||
"#,
|
||||
",
|
||||
))
|
||||
.await?;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//! Migrations for maintaining the database schema
|
||||
//! Migrations for maintaining the database schema.
|
||||
|
||||
seamantic::migrations! {
|
||||
"seaql_migrations_flix";
|
||||
|
||||
Reference in New Issue
Block a user