Class: ActsAsMessageable::MigrationGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Extended by:
T::Sig
Includes:
Rails::Generators::Migration
Defined in:
lib/generators/acts_as_messageable/migration/migration_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(dirname) ⇒ Object



19
20
21
# File 'lib/generators/acts_as_messageable/migration/migration_generator.rb', line 19

def self.next_migration_number(dirname)
  ActiveRecord::Generators::Base.next_migration_number(dirname)
end

Instance Method Details

#create_migration_fileObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/generators/acts_as_messageable/migration/migration_generator.rb', line 24

def create_migration_file
  begin
    migration_template 'migration.rb', 'db/migrate/create_messages_table.rb'
  rescue StandardError
    nil
  end
  begin
    migration_template 'migration_permanent.rb',
                       'db/migrate/add_recipient_permanent_delete_and_sender_permanent_delete_to_messages.rb'
  rescue StandardError
    nil
  end
  begin
    migration_template 'migration_opened_as_datetime.rb', 'db/migrate/add_opened_at_to_messages.rb'
  rescue StandardError
    nil
  end
  begin
    migration_template 'migration_indexes.rb', 'db/migrate/add_indexes_to_messages.rb'
  rescue StandardError
    nil
  end
end