mirror of
https://github.com/n08i40k/schedule-parser-rusted.git
synced 2026-09-14 08:58:53 +03:00
fix(tests): use local sqlite for tests and adapt test after jwt library update
This commit is contained in:
@@ -3,6 +3,9 @@ name = "database"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[features]
|
||||
sqlite = ["sea-orm/sqlx-sqlite", "migration/sqlite"]
|
||||
|
||||
[dependencies]
|
||||
migration = { path = "migration" }
|
||||
entity = { path = "entity" }
|
||||
|
||||
@@ -8,6 +8,9 @@ publish = false
|
||||
name = "migration"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[features]
|
||||
sqlite = ["sea-orm-migration/sqlx-sqlite"]
|
||||
|
||||
[dependencies]
|
||||
async-std = { version = "1", features = ["attributes", "tokio1"] }
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use sea_orm_migration::prelude::extension::postgres::Type;
|
||||
use sea_orm_migration::sea_orm::{EnumIter, Iterable};
|
||||
use sea_orm_migration::sea_orm::{DatabaseBackend, EnumIter, Iterable};
|
||||
use sea_orm_migration::{prelude::*, schema::*};
|
||||
|
||||
#[derive(DeriveMigrationName)]
|
||||
@@ -8,14 +8,16 @@ pub struct Migration;
|
||||
#[async_trait::async_trait]
|
||||
impl MigrationTrait for Migration {
|
||||
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||
manager
|
||||
.create_type(
|
||||
Type::create()
|
||||
.as_enum(UserRole)
|
||||
.values(UserRoleVariants::iter())
|
||||
.to_owned(),
|
||||
)
|
||||
.await?;
|
||||
if manager.get_database_backend() == DatabaseBackend::Postgres {
|
||||
manager
|
||||
.create_type(
|
||||
Type::create()
|
||||
.as_enum(UserRole)
|
||||
.values(UserRoleVariants::iter())
|
||||
.to_owned(),
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
|
||||
manager
|
||||
.create_table(
|
||||
@@ -40,9 +42,13 @@ impl MigrationTrait for Migration {
|
||||
.drop_table(Table::drop().table(User::Table).to_owned())
|
||||
.await?;
|
||||
|
||||
manager
|
||||
.drop_type(Type::drop().name(UserRole).to_owned())
|
||||
.await
|
||||
if manager.get_database_backend() == DatabaseBackend::Postgres {
|
||||
manager
|
||||
.drop_type(Type::drop().name(UserRole).to_owned())
|
||||
.await?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user