Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable --universal-time by default #1420

Merged
merged 2 commits into from
Jan 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 13 additions & 1 deletion sea-orm-cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,21 @@ pub enum MigrateSubcommands {
#[clap(
action,
long,
help = "Generate migration file based on Utc time instead of Local time"
default_value = "true",
help = "Generate migration file based on Utc time",
conflicts_with = "local-time",
display_order = 1001
)]
universal_time: bool,

#[clap(
action,
long,
help = "Generate migration file based on Local time",
conflicts_with = "universal-time",
display_order = 1002
)]
local_time: bool,
},
#[clap(about = "Drop all tables from the database, then reapply all migrations")]
Fresh,
Expand Down
3 changes: 2 additions & 1 deletion sea-orm-cli/src/commands/migrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ pub fn run_migrate_command(
Some(MigrateSubcommands::Generate {
migration_name,
universal_time,
}) => run_migrate_generate(migration_dir, &migration_name, universal_time)?,
local_time,
}) => run_migrate_generate(migration_dir, &migration_name, !local_time)?,
_ => {
let (subcommand, migration_dir, steps, verbose) = match command {
Some(MigrateSubcommands::Fresh) => ("fresh", migration_dir, None, verbose),
Expand Down
3 changes: 2 additions & 1 deletion sea-orm-migration/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ where
Some(MigrateSubcommands::Generate {
migration_name,
universal_time,
}) => run_migrate_generate(MIGRATION_DIR, &migration_name, universal_time)?,
local_time,
}) => run_migrate_generate(MIGRATION_DIR, &migration_name, !local_time)?,
_ => M::up(db, None).await?,
};

Expand Down