18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/eucalypt/migration/namespaces/migration-drop/generators/table.rb', line 18
def generate(name:)
name = Inflect.resource_keep_inflection(name.to_s)
sleep 1
migration_name = "drop_#{name}"
migration = Eucalypt::Helpers::Migration[title: migration_name, template: 'migration_base.tt']
return unless migration.create_anyway? if migration.exists?
config = {migration_class_name: migration_name.camelize}
template migration.template, migration.file_path, config
insert_into_file migration.file_path, :after => "def change\n" do
String.build do |s|
s << " drop_table :#{name}\n"
end
end
end
|