Sha256: d02c1385b74d487d5adcc6b5fece95fee46eb0d36c2974fb3a505f4f37498053
Contents?: true
Size: 1.39 KB
Versions: 25
Compression:
Stored size: 1.39 KB
Contents
require 'lanes/db/migrations' module Lanes module Migrations class InstallGenerator < Rails::Generators::Base include Rails::Generators::Migration source_root Lanes::DB::Migrations.paths.first Lanes::DB::Migrations.paths.slice(1..-1).each do | source_path | source_paths << source_path end desc "Install Stockor migrations" def self.next_migration_number(path) unless @prev_migration_nr @prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i else @prev_migration_nr += 1 end @prev_migration_nr.to_s end def copy_migrations Lanes::DB::Migrations.paths.each do | source_path | Pathname.glob( source_path.join('*') ).each do | migration | from = File.basename( migration ) dest = from.gsub(/^\d+_(.*).rb$/,'\\1.rb') if self.class.migration_exists?("db/migrate", "#{dest}") say_status("skipped", "Migration #{dest} already exists") else migration_template( from, "db/migrate/#{dest}" ) end end end end end end end
Version data entries
25 entries across 25 versions & 1 rubygems