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 ##