Sha256: 5a26fad7c0253e3e49b1087d9db5eb6d4467f9554bbc05d2c2cc5595c97068c4

Contents?: true

Size: 1.22 KB

Versions: 19

Compression:

Stored size: 1.22 KB

Contents

module EffectiveOrders
  module Generators
    class UpgradeFrom1xGenerator < Rails::Generators::Base
      include Rails::Generators::Migration

      desc 'Upgrade effective_orders from the 1.x branch'

      source_root File.expand_path('../../templates', __FILE__)

      def self.next_migration_number(dirname)
        ActiveRecord::Migration.new.next_migration_number(1) #=> “20160114171807"
      end

      def create_migration_file
        @orders_table_name = ':' + EffectiveOrders.orders_table_name.to_s
        @order_items_table_name = ':' + EffectiveOrders.order_items_table_name.to_s
        @carts_table_name = ':' + EffectiveOrders.carts_table_name.to_s
        @cart_items_table_name = ':' + EffectiveOrders.cart_items_table_name.to_s
        @customers_table_name = ':' + EffectiveOrders.customers_table_name.to_s
        @subscriptions_table_name = ':' + EffectiveOrders.subscriptions_table_name.to_s
        @products_table_name = ':' + EffectiveOrders.products_table_name.to_s

        migration_template '../../../db/upgrade/03_upgrade_effective_orders_from1x.rb.erb', 'db/migrate/upgrade_effective_orders_from1x.rb'
      end

      def show_readme
        readme 'README' if behavior == :invoke
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
effective_orders-2.1.17 lib/generators/effective_orders/upgrade_from1x_generator.rb
effective_orders-2.1.16 lib/generators/effective_orders/upgrade_from1x_generator.rb
effective_orders-2.1.15 lib/generators/effective_orders/upgrade_from1x_generator.rb
effective_orders-2.1.14 lib/generators/effective_orders/upgrade_from1x_generator.rb
effective_orders-2.1.13 lib/generators/effective_orders/upgrade_from1x_generator.rb
effective_orders-2.1.12 lib/generators/effective_orders/upgrade_from1x_generator.rb
effective_orders-2.1.10 lib/generators/effective_orders/upgrade_from1x_generator.rb
effective_orders-2.1.9 lib/generators/effective_orders/upgrade_from1x_generator.rb
effective_orders-2.1.8 lib/generators/effective_orders/upgrade_from1x_generator.rb
effective_orders-2.1.7 lib/generators/effective_orders/upgrade_from1x_generator.rb
effective_orders-2.1.6 lib/generators/effective_orders/upgrade_from1x_generator.rb
effective_orders-2.1.5 lib/generators/effective_orders/upgrade_from1x_generator.rb
effective_orders-2.1.4 lib/generators/effective_orders/upgrade_from1x_generator.rb
effective_orders-2.1.3 lib/generators/effective_orders/upgrade_from1x_generator.rb
effective_orders-2.1.2 lib/generators/effective_orders/upgrade_from1x_generator.rb
effective_orders-2.1.1 lib/generators/effective_orders/upgrade_from1x_generator.rb
effective_orders-2.1.0 lib/generators/effective_orders/upgrade_from1x_generator.rb
effective_orders-2.0.1 lib/generators/effective_orders/upgrade_from1x_generator.rb
effective_orders-2.0.0 lib/generators/effective_orders/upgrade_from1x_generator.rb