Sha256: ed3c266a4e342896339eb212cb47a94be58fb7c59faa658b60bfe12c7b184f47

Contents?: true

Size: 1.25 KB

Versions: 64

Compression:

Stored size: 1.25 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

        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

64 entries across 64 versions & 1 rubygems

Version Path
effective_orders-1.8.1 lib/generators/effective_orders/upgrade_from03x_generator.rb
effective_orders-1.8.0 lib/generators/effective_orders/upgrade_from03x_generator.rb
effective_orders-1.7.5 lib/generators/effective_orders/upgrade_from03x_generator.rb
effective_orders-1.7.4 lib/generators/effective_orders/upgrade_from03x_generator.rb
effective_orders-1.7.3 lib/generators/effective_orders/upgrade_from03x_generator.rb
effective_orders-1.7.2 lib/generators/effective_orders/upgrade_from03x_generator.rb
effective_orders-1.7.1 lib/generators/effective_orders/upgrade_from03x_generator.rb
effective_orders-1.7.0 lib/generators/effective_orders/upgrade_from03x_generator.rb
effective_orders-1.6.6 lib/generators/effective_orders/upgrade_from03x_generator.rb
effective_orders-1.6.5 lib/generators/effective_orders/upgrade_from03x_generator.rb
effective_orders-1.6.4 lib/generators/effective_orders/upgrade_from03x_generator.rb
effective_orders-1.6.3 lib/generators/effective_orders/upgrade_from03x_generator.rb
effective_orders-1.6.1 lib/generators/effective_orders/upgrade_from03x_generator.rb
effective_orders-1.6.0 lib/generators/effective_orders/upgrade_from03x_generator.rb
effective_orders-1.5.9 lib/generators/effective_orders/upgrade_from03x_generator.rb
effective_orders-1.5.8 lib/generators/effective_orders/upgrade_from03x_generator.rb
effective_orders-1.5.7 lib/generators/effective_orders/upgrade_from03x_generator.rb
effective_orders-1.5.5 lib/generators/effective_orders/upgrade_from03x_generator.rb
effective_orders-1.5.4 lib/generators/effective_orders/upgrade_from03x_generator.rb
effective_orders-1.5.3 lib/generators/effective_orders/upgrade_from03x_generator.rb