activerecord-migrations 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_record/migrations/generator.rb +41 -0
- data/lib/active_record/migrations/tasks/db.rb +1 -1
- data/lib/active_record/migrations/tasks/db/migrations.rb +3 -3
- data/lib/active_record/migrations/version.rb +1 -1
- metadata +2 -2
- data/lib/active_record/migrations/tasks/db/generators.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d638b63c5c8e22e7da7c043b28fd11572f649d2d
|
4
|
+
data.tar.gz: 276ac84d4cd5c477419620ff1580d29d4e7b5275
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a62506e9d2e75a553eb5f6d6b8af023613aba6595d4d5ba416e33eb6b12a9af32c99d4f893fc1b1bf290ea4d544caaa85fce8e06f309d115464570e55228d2e9
|
7
|
+
data.tar.gz: d10972e07782d7ebea25dc1bebc164f8b5f5ec06ec0be84b8f8008712ce261dd4f77429cdeb64319ff4a9c3b4cb19f66be6d8668fb3a29b8d839d16b583a0f37
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# Copyright, 2017, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the "Software"), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in
|
11
|
+
# all copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
# THE SOFTWARE.
|
20
|
+
|
21
|
+
require 'rails/generators'
|
22
|
+
require 'rails/generators/active_record/migration/migration_generator'
|
23
|
+
require 'active_record/tasks/database_tasks'
|
24
|
+
|
25
|
+
module ActiveRecord
|
26
|
+
module Migrations
|
27
|
+
class Generator < ::ActiveRecord::Generators::MigrationGenerator
|
28
|
+
source_root ::ActiveRecord::Generators::MigrationGenerator.source_root
|
29
|
+
|
30
|
+
def create_migration_file
|
31
|
+
set_local_assigns!
|
32
|
+
validate_file_name!
|
33
|
+
migration_template @migration_template, File.join(db_migrate_path, "#{file_name}.rb")
|
34
|
+
end
|
35
|
+
|
36
|
+
def db_migrate_path
|
37
|
+
::ActiveRecord::Migrations.migrations_root
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -32,11 +32,11 @@ namespace :db do
|
|
32
32
|
options = []
|
33
33
|
end
|
34
34
|
|
35
|
-
require_relative '
|
35
|
+
require_relative '../../generator'
|
36
36
|
|
37
37
|
parameters = [name] + options
|
38
|
-
|
39
|
-
|
38
|
+
|
39
|
+
Rails::Generators.invoke "active_record:migrations:generator", parameters, :destination_root => ActiveRecord::Migrations.root
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-migrations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -110,10 +110,10 @@ files:
|
|
110
110
|
- Rakefile
|
111
111
|
- activerecord-migrations.gemspec
|
112
112
|
- lib/active_record/migrations.rb
|
113
|
+
- lib/active_record/migrations/generator.rb
|
113
114
|
- lib/active_record/migrations/tasks.rb
|
114
115
|
- lib/active_record/migrations/tasks/db.rb
|
115
116
|
- lib/active_record/migrations/tasks/db/fixtures.rb
|
116
|
-
- lib/active_record/migrations/tasks/db/generators.rb
|
117
117
|
- lib/active_record/migrations/tasks/db/migrations.rb
|
118
118
|
- lib/active_record/migrations/tasks/db/seed.rb
|
119
119
|
- lib/active_record/migrations/version.rb
|
@@ -1,13 +0,0 @@
|
|
1
|
-
|
2
|
-
require 'rails/generators'
|
3
|
-
|
4
|
-
if ActiveRecord::version >= Gem::Version.new("5.0.2")
|
5
|
-
# This is a monkey patch to work around the flakey design of ActiveRecord migrations.
|
6
|
-
require 'rails/generators/active_record/migration/migration_generator'
|
7
|
-
|
8
|
-
class ::ActiveRecord::Generators::MigrationGenerator
|
9
|
-
def db_migrate_path
|
10
|
-
ActiveRecord::Migrations.migrations_root
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|