Class: TkhIllustrations::Generators::CreateOrUpdateMigrationsGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Rails::Generators::Migration
Defined in:
lib/generators/tkh_illustrations/create_or_update_migrations/create_or_update_migrations_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(path) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/generators/tkh_illustrations/create_or_update_migrations/create_or_update_migrations_generator.rb', line 9

def self.next_migration_number(path)
  unless @prev_migration_nr
    @prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
  else
    @prev_migration_nr += 1
  end
  @prev_migration_nr.to_s
end

Instance Method Details

#create_or_update_migrationsObject



18
19
20
21
22
23
24
25
26
27
# File 'lib/generators/tkh_illustrations/create_or_update_migrations/create_or_update_migrations_generator.rb', line 18

def create_or_update_migrations
  puts 'Creating the illustrations table'
  migration_template "create_illustrations.rb", "db/migrate/create_illustrations.rb"
  puts 'Adding translation of name attribute for Globalize3'
  migration_template "add_translation_of_name_to_illustrations.rb", "db/migrate/add_translation_of_name_to_illustrations.rb"
  puts 'Creating the headers table'
  migration_template "create_headers.rb", "db/migrate/create_headers.rb"
  puts 'Creating the downloads table'
  migration_template "create_downloads.rb", "db/migrate/create_downloads.rb"
end