migration_data 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -0
- data/Gemfile +6 -0
- data/lib/migration_data/version.rb +1 -1
- data/migration_data.gemspec +3 -4
- data/test/rake_task_test.rb +1 -1
- data/test/schema_dumper_test.rb +1 -1
- data/test/squash_test.rb +1 -1
- data/test/test_helper.rb +6 -0
- metadata +8 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4850001d7a0722db5b532dc29da4137d3be31df2
|
4
|
+
data.tar.gz: 5082292a2f2c707437a95629db472c52630d0efe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92d2a6d2f7be86629e69c11a2515dd88f8496d1052467945bd7c85d5ad78d7d495ca37a73d32685765e725c13d0f49bcd9aa13972d41b5c2d72f094d063d0e17
|
7
|
+
data.tar.gz: 432041bddc31e4a414a63511bab485ba3a43027fb6d2e70dd17a94b6fd66a70c71adeeaf5b742d85106ec571d0b26b810731da18e5fda2e31799f0a51e64930d
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/migration_data.gemspec
CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
|
|
14
14
|
some techniques which help to avoid these pitfalls. For example, define model
|
15
15
|
classes in the migrations or write raw SQL. But they don't help in 100% cases anyway.
|
16
16
|
This gem promises to solve the problem in a simple way.}
|
17
|
-
spec.homepage = ""
|
17
|
+
spec.homepage = "http://railsguides.net/change-data-in-migrations-like-a-boss/"
|
18
18
|
spec.license = "MIT"
|
19
19
|
|
20
20
|
spec.files = `git ls-files`.split($/)
|
@@ -23,7 +23,6 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.require_paths = ["lib"]
|
24
24
|
|
25
25
|
spec.add_development_dependency 'bundler', '~> 1.5'
|
26
|
-
spec.add_development_dependency 'rake'
|
27
|
-
spec.add_development_dependency 'sqlite3'
|
28
|
-
spec.add_dependency 'rails', '>= 4.0.0.rc1'
|
26
|
+
spec.add_development_dependency 'rake', '~> 0'
|
27
|
+
spec.add_development_dependency 'sqlite3', '~> 0'
|
29
28
|
end
|
data/test/rake_task_test.rb
CHANGED
@@ -19,7 +19,7 @@ describe 'db:schema:squash' do
|
|
19
19
|
assert_equal <<-MIGRATION, File.read(latest_migration)
|
20
20
|
class CreateSchema < ActiveRecord::Migration
|
21
21
|
def change
|
22
|
-
create_table \"users\", force:
|
22
|
+
create_table \"users\", force: #{FOURCE_MIGRATION} do |t|
|
23
23
|
t.string \"name\"
|
24
24
|
end
|
25
25
|
end
|
data/test/schema_dumper_test.rb
CHANGED
@@ -10,7 +10,7 @@ describe MigrationData::ActiveRecord::SchemaDumper do
|
|
10
10
|
it 'squashes the schema' do
|
11
11
|
stream = MigrationData::ActiveRecord::SchemaDumper.dump
|
12
12
|
assert_equal <<-SCHEMA, stream.string
|
13
|
-
create_table \"users\", force:
|
13
|
+
create_table \"users\", force: #{FOURCE_MIGRATION} do |t|
|
14
14
|
t.string \"name\"
|
15
15
|
end
|
16
16
|
|
data/test/squash_test.rb
CHANGED
@@ -17,7 +17,7 @@ describe MigrationData::Squash do
|
|
17
17
|
assert_equal <<-MIGRATION, File.read(db_path.join('100500_create_schema.rb'))
|
18
18
|
class CreateSchema < ActiveRecord::Migration
|
19
19
|
def change
|
20
|
-
create_table \"users\", force:
|
20
|
+
create_table \"users\", force: #{FOURCE_MIGRATION} do |t|
|
21
21
|
t.string \"name\"
|
22
22
|
end
|
23
23
|
end
|
data/test/test_helper.rb
CHANGED
@@ -5,3 +5,9 @@ require 'rails'
|
|
5
5
|
Dir[File.join(File.dirname(__FILE__), 'support', '**/*.rb')].each { |f| require f }
|
6
6
|
|
7
7
|
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: 'tmp/test.sqlite3')
|
8
|
+
|
9
|
+
FOURCE_MIGRATION = if ActiveRecord.version < Gem::Version.new('4.2.0.rc1')
|
10
|
+
'true'
|
11
|
+
else
|
12
|
+
':cascade'
|
13
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: migration_data
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrey Koleshko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -28,44 +28,30 @@ dependencies:
|
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: sqlite3
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rails
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 4.0.0.rc1
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: 4.0.0.rc1
|
69
55
|
description: |-
|
70
56
|
Sometimes we have to write some Rails code in the migrations and it's hard to
|
71
57
|
keep them in working state because models wich are used there changes too often. there
|
@@ -102,7 +88,7 @@ files:
|
|
102
88
|
- test/support/create_table_migration.rb
|
103
89
|
- test/support/rails_app.rb
|
104
90
|
- test/test_helper.rb
|
105
|
-
homepage:
|
91
|
+
homepage: http://railsguides.net/change-data-in-migrations-like-a-boss/
|
106
92
|
licenses:
|
107
93
|
- MIT
|
108
94
|
metadata: {}
|
@@ -137,3 +123,4 @@ test_files:
|
|
137
123
|
- test/support/create_table_migration.rb
|
138
124
|
- test/support/rails_app.rb
|
139
125
|
- test/test_helper.rb
|
126
|
+
has_rdoc:
|