good_migrations 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -0
- data/README.md +10 -4
- data/good_migrations.gemspec +1 -0
- data/lib/good_migrations/version.rb +1 -1
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05eb20b7481ddae6720347b0c84275997ff53e72
|
4
|
+
data.tar.gz: b7c85f764f8f2c22a3988517f2c272cdb59d0016
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b79f08edebb75e97c2358064c31d8c5d2de7e4cb483b5e4f7e61a4fe04b6550156c271995249af7327a66b1f5767269830ec0fe01b7144a4fcaa6a257d244689
|
7
|
+
data.tar.gz: 285bfb5be43c16860c0e6bff42c5e024d24199d4a9a84e9de1f946d04a979bbac87156c0603124c87aac80aecef81f0cd47690daf699bf27c73f2770ad0465fc
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
# good_migrations
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
[![Build Status](https://travis-ci.org/testdouble/good-migrations.svg?branch=master)](https://travis-ci.org/testdouble/good-migrations)
|
4
|
+
|
5
|
+
This gem prevents Rails from auto-loading app code while it's running migrations,
|
6
|
+
preventing the common mistake of referencing ActiveRecord models from migration
|
7
|
+
code.
|
5
8
|
|
6
9
|
## Usage
|
7
10
|
|
@@ -30,12 +33,12 @@ That means that if your migrations reference the ActiveRecord model objects
|
|
30
33
|
you've defined in `app/models`, your old migrations are likely to break. That's
|
31
34
|
not good.
|
32
35
|
|
33
|
-
By adding this gem to your project's `Gemfile`, autoloading paths inside 'app
|
36
|
+
By adding this gem to your project's `Gemfile`, autoloading paths inside `'app/'`
|
34
37
|
while running any of the `db:migrate` Rake tasks will raise an error, explaining
|
35
38
|
the dangers inherent.
|
36
39
|
|
37
40
|
Some will reply, "who cares if old migrations are broken? I can still run `rake
|
38
|
-
db:setup` because I have a `db/schema.rb file". The problem with this approach
|
41
|
+
db:setup` because I have a `db/schema.rb` file". The problem with this approach
|
39
42
|
is that, so long as some migrations aren't runnable, the `db/schema.rb` can't
|
40
43
|
be regenerated from scratch and its veracity can no longer be trusted. In
|
41
44
|
practice, we've seen numerous projects accumulate cruft in `db/schema.rb` as the
|
@@ -43,6 +46,9 @@ result of erroneous commits to work-in-progress migrations, leading to the
|
|
43
46
|
development and test databases falling out of sync with production. That's not
|
44
47
|
good!
|
45
48
|
|
49
|
+
For more background, see the last section of this blog post on [healthy migration
|
50
|
+
habits](http://blog.testdouble.com/posts/2014-11-04-healthy-migration-habits.html)
|
51
|
+
|
46
52
|
## Options
|
47
53
|
|
48
54
|
There's no public API to this gem. If you want to work around its behavior, you
|
data/good_migrations.gemspec
CHANGED
@@ -19,6 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
spec.add_dependency "railties", ">= 3.1"
|
22
|
+
spec.add_dependency "activerecord", ">= 3.1"
|
22
23
|
|
23
24
|
spec.add_development_dependency "bundler", "~> 1.10"
|
24
25
|
spec.add_development_dependency "rake", "~> 10.0"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: good_migrations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Searls
|
@@ -25,6 +25,20 @@ dependencies:
|
|
25
25
|
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '3.1'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: activerecord
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '3.1'
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '3.1'
|
28
42
|
- !ruby/object:Gem::Dependency
|
29
43
|
name: bundler
|
30
44
|
requirement: !ruby/object:Gem::Requirement
|