Add -t, --target

This commit is contained in:
0x1eef 2024-04-27 00:38:02 -03:00
parent 3105be205e
commit e651789ed4
2 changed files with 6 additions and 4 deletions

View file

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

View file

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