Sha256: 42bbc45488f70dc79559bc79d6e3382a8b88ffcf6fee77af105922ccbaec4757
Contents?: true
Size: 993 Bytes
Versions: 5
Compression:
Stored size: 993 Bytes
Contents
# bundle exec rails generate effective_orders:upgrade_price_column TABLE COLUMN module EffectiveOrders module Generators class UpgradePriceColumn < Rails::Generators::Base include Rails::Generators::Migration desc "Upgrade a table with a decimal column to integer" source_root File.expand_path("../../templates", __FILE__) argument :table, :type => :string, :default => nil argument :column, :type => :string, :default => :price def self.next_migration_number(dirname) if not ActiveRecord::Base.timestamped_migrations Time.new.utc.strftime("%Y%m%d%H%M%S") else "%.3d" % (current_migration_number(dirname) + 1) end end def create_migration_file @table = table.to_s.downcase @column = column.to_s.downcase migration_template ('../' * 3) + 'db/upgrade/upgrade_price_column_on_table.rb.erb', "db/migrate/upgrade_price_column_on_#{table}.rb" end end end end
Version data entries
5 entries across 5 versions & 1 rubygems