From afe4c76392ddea602f8775b090714e3bf20378af Mon Sep 17 00:00:00 2001 From: Namekuji Date: Fri, 2 Jun 2023 23:37:36 -0400 Subject: [PATCH] fix migration --- packages/backend/native-utils/Cargo.toml | 2 +- packages/backend/native-utils/migration/Cargo.toml | 4 ++-- .../migration/src/m20230531_180824_drop_reversi.rs | 2 ++ packages/backend/native-utils/migration/src/vec_to_json.rs | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/backend/native-utils/Cargo.toml b/packages/backend/native-utils/Cargo.toml index 071d0f331b..9b030e37da 100644 --- a/packages/backend/native-utils/Cargo.toml +++ b/packages/backend/native-utils/Cargo.toml @@ -4,7 +4,7 @@ name = "native-utils" version = "0.0.0" [workspace] -members = ["migration/Cargo.toml"] +members = ["migration"] [features] default = [] diff --git a/packages/backend/native-utils/migration/Cargo.toml b/packages/backend/native-utils/migration/Cargo.toml index dbfd41be69..0b4b2b2e7f 100644 --- a/packages/backend/native-utils/migration/Cargo.toml +++ b/packages/backend/native-utils/migration/Cargo.toml @@ -10,12 +10,12 @@ path = "src/lib.rs" [features] default = [] -convert = ["model/noarray"] +convert = ["dep:native-utils"] [dependencies] async-std = { version = "1", features = ["attributes", "tokio1"] } serde_json = "1.0.96" -model = { path = "../model" } +native-utils = { path = "../", optional = true } indicatif = { version = "0.17.4", features = ["tokio"] } tokio = { version = "1.28.2", features = ["full"] } futures = "0.3.28" diff --git a/packages/backend/native-utils/migration/src/m20230531_180824_drop_reversi.rs b/packages/backend/native-utils/migration/src/m20230531_180824_drop_reversi.rs index c2726dd765..32b8dae223 100644 --- a/packages/backend/native-utils/migration/src/m20230531_180824_drop_reversi.rs +++ b/packages/backend/native-utils/migration/src/m20230531_180824_drop_reversi.rs @@ -18,6 +18,7 @@ impl MigrationTrait for Migration { DbBackend::Postgres, Table::drop() .table(ReversiGame::Table) + .if_exists() .to_string(PostgresQueryBuilder), )) .await?; @@ -25,6 +26,7 @@ impl MigrationTrait for Migration { DbBackend::Postgres, Table::drop() .table(ReversiMatching::Table) + .if_exists() .to_string(PostgresQueryBuilder), )) .await?; diff --git a/packages/backend/native-utils/migration/src/vec_to_json.rs b/packages/backend/native-utils/migration/src/vec_to_json.rs index c762dcf1cc..c4a6d9b073 100644 --- a/packages/backend/native-utils/migration/src/vec_to_json.rs +++ b/packages/backend/native-utils/migration/src/vec_to_json.rs @@ -1,7 +1,7 @@ -#![allow(dead_code)] +#![cfg(feature = "convert")] use indicatif::{MultiProgress, ProgressBar, ProgressStyle}; -use model::entity::newtype::{I32Vec, StringVec}; +use native_utils::model::entity::newtype::{I32Vec, StringVec}; use sea_orm_migration::{ prelude::*, sea_orm::{Database, DbBackend, DbConn, Statement, TryGetable},