Sha256: eb565f1b5721c94f8e1bc32e52ceabbb94142f815383c92b0d1a54c0f607ede3

Contents?: true

Size: 976 Bytes

Versions: 18

Compression:

Stored size: 976 Bytes

Contents

module Hanami
  class CLI
    module Commands
      module Db
        # @since 1.1.0
        # @api private
        class Migrate < Command
          requires "model.sql"

          desc "Migrate the database"

          argument :version, desc: "The target version of the migration (see `hanami db version`)"

          example [
            "               # Migrate to the last version",
            "#{Project.migration_timestamp} # Migrate to a specific version"
          ]

          # @since 1.1.0
          # @api private
          def call(version: nil, **options)
            context = Context.new(version: version, options: options)

            migrate_database(context)
          end

          private

          # @since 1.1.0
          # @api private
          def migrate_database(context)
            require "hanami/model/migrator"
            Hanami::Model::Migrator.migrate(version: context.version)
          end
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
hanami-1.3.5 lib/hanami/cli/commands/db/migrate.rb
hanami-1.3.4 lib/hanami/cli/commands/db/migrate.rb
hanami-1.3.3 lib/hanami/cli/commands/db/migrate.rb
hanami-1.3.2 lib/hanami/cli/commands/db/migrate.rb
hanami-1.3.1 lib/hanami/cli/commands/db/migrate.rb
hanami-1.3.0 lib/hanami/cli/commands/db/migrate.rb
hanami-1.3.0.beta1 lib/hanami/cli/commands/db/migrate.rb
hanami-1.2.0 lib/hanami/cli/commands/db/migrate.rb
hanami-1.2.0.rc2 lib/hanami/cli/commands/db/migrate.rb
hanami-1.2.0.rc1 lib/hanami/cli/commands/db/migrate.rb
hanami-1.2.0.beta2 lib/hanami/cli/commands/db/migrate.rb
hanami-1.2.0.beta1 lib/hanami/cli/commands/db/migrate.rb
hanami-1.1.1 lib/hanami/cli/commands/db/migrate.rb
hanami-1.1.0 lib/hanami/cli/commands/db/migrate.rb
hanami-1.1.0.rc1 lib/hanami/cli/commands/db/migrate.rb
hanami-1.1.0.beta3 lib/hanami/cli/commands/db/migrate.rb
hanami-1.1.0.beta2 lib/hanami/cli/commands/db/migrate.rb
hanami-1.1.0.beta1 lib/hanami/cli/commands/db/migrate.rb