Class: Glueby::Contract::TimestampGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Extended by:
Generator::MigrateGenerator::ClassMethod
Includes:
Generator::MigrateGenerator, Rails::Generators::Migration
Defined in:
lib/generators/glueby/contract/timestamp_generator.rb

Constant Summary

Constants included from Generator::MigrateGenerator

Generator::MigrateGenerator::MYSQL_ADAPTERS

Instance Method Summary collapse

Methods included from Generator::MigrateGenerator::ClassMethod

next_migration_number

Methods included from Generator::MigrateGenerator

#migration_version, #mysql?, #table_options

Instance Method Details

#create_migration_fileObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/generators/glueby/contract/timestamp_generator.rb', line 10

def create_migration_file
  migration_dir = File.expand_path("db/migrate")

  if self.class.migration_exists?(migration_dir, "create_timestamp")
    ::Kernel.warn "Migration already exists: create_timestamp"
  else
    migration_template(
      "timestamp_table.rb.erb",
      "db/migrate/create_timestamp.rb",
      migration_version: migration_version,
      table_options: table_options,
    )
  end
end