Sha256: 53eb48b90dce89231cb658340e64d7d1c715ee920e4f59828a6127a949de8d30
Contents?: true
Size: 1.01 KB
Versions: 6
Compression:
Stored size: 1.01 KB
Contents
# frozen_string_literal: true require 'rails/generators' require 'rails/generators/active_record' module IsThisUsed class MigrationGenerator < Rails::Generators::Base include Rails::Generators::Migration source_root File.expand_path('templates', __dir__) def create_migration_file create_potential_crufts create_potential_cruft_stacks end def self.next_migration_number(dirname) ActiveRecord::Generators::Base.next_migration_number(dirname) end private def create_potential_crufts create_table('potential_crufts') end def create_potential_cruft_stacks create_table('potential_cruft_stacks') end def create_table(table) migration_template( "create_#{table}.rb.erb", "db/migrate/create_#{table}.rb", { migration_version: migration_version } ) end def migration_version format( '[%d.%d]', ActiveRecord::VERSION::MAJOR, ActiveRecord::VERSION::MINOR ) end end end
Version data entries
6 entries across 6 versions & 1 rubygems