From e651789ed4f01d0ef9ba88dccb7911960fee9106 Mon Sep 17 00:00:00 2001 From: 0x1eef <0x1eef@protonmail.com> Date: Sat, 27 Apr 2024 00:38:02 -0300 Subject: [PATCH] Add -t, --target --- cli/lib/twenty/cli/command/migrate.rb | 4 +++- server/lib/twenty/server/migration.rb | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/cli/lib/twenty/cli/command/migrate.rb b/cli/lib/twenty/cli/command/migrate.rb index a081c29..4804843 100644 --- a/cli/lib/twenty/cli/command/migrate.rb +++ b/cli/lib/twenty/cli/command/migrate.rb @@ -3,6 +3,8 @@ class Twenty::Command::Migrate < Twenty::Command set_banner usage: "twenty migrate [OPTIONS]", description: "Migrate the database" + set_option "-t TARGET", "--target TARGET", "The target version", default: nil + include CommonOptionMixin prepend Twenty::Command::SQLiteMixin prepend Twenty::Command::RescueMixin @@ -15,6 +17,6 @@ class Twenty::Command::Migrate < Twenty::Command private def run_command(options) - Twenty::Migration.run! + Twenty::Migration.run!(target: options.target) end end diff --git a/server/lib/twenty/server/migration.rb b/server/lib/twenty/server/migration.rb index 0f2a779..23f0fea 100644 --- a/server/lib/twenty/server/migration.rb +++ b/server/lib/twenty/server/migration.rb @@ -10,10 +10,10 @@ module Twenty::Migration end ## - # Runs migrations (if neccessary). + # Run migrations # @return [void] - def self.run! - Sequel::Migrator.run(Twenty.connection, migrations_path) + def self.run!(options = {}) + Sequel::Migrator.run(Twenty.connection, migrations_path, options) end ##