Sha256: 3738eb31ffda29bacc4bc0be128dfd11314ef70ede497ba5feaf801fc68d00fd

Contents?: true

Size: 907 Bytes

Versions: 6

Compression:

Stored size: 907 Bytes

Contents

# frozen_string_literal: true

require "snowpack/cli/application/command"
require_relative "structure/dump"
require_relative "utils/database"

module Snowpack
  module CLI
    module Application
      module Commands
        module DB
          class CreateMigration < Command
            desc "Create new migration file"

            argument :name, desc: "Migration file name"

            def call(name:, **)
              migrator = database.migrator
              version = migrator.generate_version

              measure "migration #{version}_#{name} created" do
                migrator.create_file(name, version)
              end
            end

            private

            def database
              @database ||= Utils::Database.for_application(application)
            end
          end
        end

        register "db create_migration", DB::CreateMigration
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
snowpack-1.0.0.alpha7 lib/snowpack/cli/application/commands/db/create_migration.rb
snowpack-1.0.0.alpha6 lib/snowpack/cli/application/commands/db/create_migration.rb
snowpack-1.0.0.alpha5 lib/snowpack/cli/application/commands/db/create_migration.rb
snowpack-1.0.0.alpha4 lib/snowpack/cli/application/commands/db/create_migration.rb
snowpack-1.0.0.alpha3 lib/snowpack/cli/application/commands/db/create_migration.rb
snowpack-1.0.0.alpha2 lib/snowpack/cli/application/commands/db/create_migration.rb