old_sql 1.37.0 → 1.38.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,7 +15,7 @@ module OldSql
15
15
  end
16
16
 
17
17
  puts "Also you need a new migration. We'll generate it for you now."
18
- invoke 'old_sql:install_migrations'
18
+ invoke 'old_sql:install_migrations', ["#{model_name}"]
19
19
  end
20
20
 
21
21
  def copy_initializer
@@ -5,6 +5,7 @@ module OldSql
5
5
  class InstallMigrationsGenerator < Rails::Generators::Base
6
6
  include Rails::Generators::Migration
7
7
  source_root File.expand_path('../templates', __FILE__)
8
+ argument :model_name, :type => :string, :default => 'user'
8
9
 
9
10
  def self.next_migration_number(dirname)
10
11
  if ActiveRecord::Base.timestamped_migrations
@@ -18,7 +19,8 @@ module OldSql
18
19
 
19
20
  def create_migration_file
20
21
  sleep 1 # ensure scripts have different timestamps
21
- migration_template 'add_old_sql_admin_to_users_migration.rb', 'db/migrate/add_old_sql_admin_to_users.rb' rescue p $!.message
22
+ gsub_file 'add_old_sql_admin_to_users_migration.rb', /users/, "#{model_name}"
23
+ migration_template 'add_old_sql_admin_to_users_migration.rb', "db/migrate/add_old_sql_admin_to_#{model_name}.rb" rescue p $!.message
22
24
  #sleep 1 # ensure scripts have different timestamps
23
25
  end
24
26
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: old_sql
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.37.0
5
+ version: 1.38.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Eddie Gonzales
@@ -198,7 +198,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
198
198
  requirements:
199
199
  - - ">="
200
200
  - !ruby/object:Gem::Version
201
- hash: -4535949171049364423
201
+ hash: -3187375667189382122
202
202
  segments:
203
203
  - 0
204
204
  version: "0"