Sha256: 79fb9859657dfd065facf349e9d5ed5caaecff255101dbf840416d85347d0d6e

Contents?: true

Size: 1.33 KB

Versions: 19

Compression:

Stored size: 1.33 KB

Contents

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

      desc "Upgrade effective_orders from the 0.3.x branch"

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

      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
        @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/02_upgrade_effective_orders_from03x.rb.erb', 'db/migrate/upgrade_effective_orders_from03x.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_from03x_generator.rb
effective_orders-2.1.16 lib/generators/effective_orders/upgrade_from03x_generator.rb
effective_orders-2.1.15 lib/generators/effective_orders/upgrade_from03x_generator.rb
effective_orders-2.1.14 lib/generators/effective_orders/upgrade_from03x_generator.rb
effective_orders-2.1.13 lib/generators/effective_orders/upgrade_from03x_generator.rb
effective_orders-2.1.12 lib/generators/effective_orders/upgrade_from03x_generator.rb
effective_orders-2.1.10 lib/generators/effective_orders/upgrade_from03x_generator.rb
effective_orders-2.1.9 lib/generators/effective_orders/upgrade_from03x_generator.rb
effective_orders-2.1.8 lib/generators/effective_orders/upgrade_from03x_generator.rb
effective_orders-2.1.7 lib/generators/effective_orders/upgrade_from03x_generator.rb
effective_orders-2.1.6 lib/generators/effective_orders/upgrade_from03x_generator.rb
effective_orders-2.1.5 lib/generators/effective_orders/upgrade_from03x_generator.rb
effective_orders-2.1.4 lib/generators/effective_orders/upgrade_from03x_generator.rb
effective_orders-2.1.3 lib/generators/effective_orders/upgrade_from03x_generator.rb
effective_orders-2.1.2 lib/generators/effective_orders/upgrade_from03x_generator.rb
effective_orders-2.1.1 lib/generators/effective_orders/upgrade_from03x_generator.rb
effective_orders-2.1.0 lib/generators/effective_orders/upgrade_from03x_generator.rb
effective_orders-2.0.1 lib/generators/effective_orders/upgrade_from03x_generator.rb
effective_orders-2.0.0 lib/generators/effective_orders/upgrade_from03x_generator.rb