Class: DynamoDb::Generators::SessionStoreMigrationGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Includes:
Rails::Generators::Migration
Defined in:
lib/generators/dynamo_db/session_store_migration/session_store_migration_generator.rb

Overview

Generates an ActiveRecord migration that creates and deletes a DynamoDB Session table.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(_dir = nil) ⇒ Object

Next migration number - must be implemented



36
37
38
# File 'lib/generators/dynamo_db/session_store_migration/session_store_migration_generator.rb', line 36

def self.next_migration_number(_dir = nil)
  Time.now.utc.strftime('%Y%m%d%H%M%S')
end

Instance Method Details

#copy_sample_config_fileObject



28
29
30
31
32
33
# File 'lib/generators/dynamo_db/session_store_migration/session_store_migration_generator.rb', line 28

def copy_sample_config_file
  template(
    'dynamo_db_session_store.yml',
    'config/dynamo_db_session_store.yml'
  )
end

#generate_migration_fileRails Migration File

Returns migration file for creation and deletion of a DynamoDB session table.

Returns:

  • (Rails Migration File)

    migration file for creation and deletion of a DynamoDB session table.



21
22
23
24
25
26
# File 'lib/generators/dynamo_db/session_store_migration/session_store_migration_generator.rb', line 21

def generate_migration_file
  migration_template(
    'session_store_migration.erb',
    "db/migrate/#{name.underscore}.rb"
  )
end