Class: Generalis::Generators::MigrationsGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Generalis::Generators::MigrationsGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/generalis/migrations_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.next_migration_number(dir) ⇒ Object
13 14 15 |
# File 'lib/generators/generalis/migrations_generator.rb', line 13 def self.next_migration_number(dir) ::ActiveRecord::Generators::Base.next_migration_number(dir) end |
Instance Method Details
#create_migration_files ⇒ Object
17 18 19 20 21 22 |
# File 'lib/generators/generalis/migrations_generator.rb', line 17 def create_migration_files migration_template 'create_ledger_accounts.rb.erb', 'db/migrate/create_ledger_accounts.rb' migration_template 'create_ledger_transactions.rb.erb', 'db/migrate/create_ledger_transactions.rb' migration_template 'create_ledger_entries.rb.erb', 'db/migrate/create_ledger_entries.rb' migration_template 'create_ledger_links.rb.erb', 'db/migrate/create_ledger_links.rb' end |
#json_column_type ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/generators/generalis/migrations_generator.rb', line 24 def json_column_type case ActiveRecord::Base.connection.adapter_name when 'SQLite' then ':string' when 'MySQL' then ':json' when 'PostgreSQL' then ':jsonb' else Rails.logger.warn('Unsupported database adapter; using String for JSON data types') ':string' end end |