fix-db-schema-conflicts 1.2.2 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: af0a08da758571d3b22b68a576bd04d9d5ecd724
4
- data.tar.gz: a2306d7076190046db6904be9f32c720a0578ec0
3
+ metadata.gz: 571ecba577de388058f819df72f0f3459b6afcf8
4
+ data.tar.gz: f0caf6caa58304c3f5fee58b8e988d53e12a9b1b
5
5
  SHA512:
6
- metadata.gz: 1c5104f294abf63bb42bd455c94c0c5736702275494f3627d2f7eed651fe8e26fe50bb2930d5e5b7c58183066b0a13f36378db0ec699872fbb1b811b25b135dc
7
- data.tar.gz: 673dca7a9c198d17b3fde99b3f3b601054e38c432d4a1d7f1985374459ec6d4477c05a1fc1121af4d923681c29a259fabf0200ff369c37e0ae3814b1fb46e6c7
6
+ metadata.gz: 5f7b58604af4db20cf2560d694af80ddf0d993bb69cbe16e5c5c712cee3d912e755dbf1ff8f47ac775896a8f923e51106232b32660c0d65b709a8e556e5babc7
7
+ data.tar.gz: 9ee59fa778504bf24e60998605344e7a9deab34ee6b7ac722745a162e6661a37d75188582e72fe4240198ee242b879595360111e9524aed14c69b54d0f7fc5ab
data/README.md CHANGED
@@ -2,42 +2,47 @@
2
2
 
3
3
  # fix-db-schema-conflicts
4
4
 
5
- It prevents db/schema.rb conflicts in your Rails projects when working with multiple team members.
5
+ It prevents db/schema.rb conflicts in your Rails projects when working with
6
+ multiple team members.
6
7
 
7
8
  Specifically the situation that goes like this:
8
9
 
9
- John is working on a feature, and adds a migration to create an `updated_at` timestamp to `Task`.
10
- Sara is working on a different feature, and adds a migration to create a `name` column to `Task`.
11
- They both run their migrations locally, and then get a new copy of master with the other's feature and migration.
12
- Then when they run migrations again, John's `tasks` table looks like this:
10
+ John is working on a feature, and adds a migration to create an `updated_at`
11
+ timestamp to `Task`. Sara is working on a different feature, and adds a
12
+ migration to create a `name` column to `Task`. They both run their migrations
13
+ locally, and then get a new copy of master with the other's feature and
14
+ migration. Then when they run migrations again, John's `tasks` table looks like
15
+ this:
13
16
 
14
- t.timestamp :updated_at
15
- t.string :name
17
+ t.timestamp :updated_at t.string :name
16
18
 
17
19
  And Sara's looks like this:
18
20
 
19
- t.string :name
20
- t.timestamp :updated_at
21
+ t.string :name t.timestamp :updated_at
21
22
 
22
- And every time they run migrations before committing new code, their `db/schema.rb` file will be showing a change, because they are flipping the order of the columns.
23
+ And every time they run migrations before committing new code, their
24
+ `db/schema.rb` file will be showing a change, because they are flipping the
25
+ order of the columns.
23
26
 
24
27
  By using the fix-db-schema-conflicts gem, this problem goes away.
25
28
 
26
29
  ## How it works
27
30
 
28
- This gem sorts the table, index, and foreign key names before outputting them to the schema.rb file. Additionally it runs Rubocop with the auto-correct flag to ensure a consistent output format. Then it runs `sed` to cleanup additional horizontal whitespace inserted by Rails.
31
+ This gem sorts the table, index, extension, and foreign key names before
32
+ outputting them to the schema.rb file. Additionally it runs Rubocop with the
33
+ auto-correct flag to ensure a consistent output format.
29
34
 
30
35
  ## Usage
31
36
 
32
- You don't have to do anything different. It should just work. Simply run `rake db:migrate` or `rake db:schema:dump` as you would before and `fix-db-schema-conflicts` will do the rest.
37
+ You don't have to do anything different. It should just work. Simply run `rake
38
+ db:migrate` or `rake db:schema:dump` as you would before and `fix-db-schema-
39
+ conflicts` will do the rest.
33
40
 
34
41
  ## Installation
35
42
 
36
43
  Add this line to your application's Gemfile in your development group:
37
44
 
38
- ```ruby
39
- gem 'fix-db-schema-conflicts'
40
- ```
45
+ ```ruby gem 'fix-db-schema-conflicts' ```
41
46
 
42
47
  And then execute:
43
48
 
@@ -45,11 +50,17 @@ And then execute:
45
50
 
46
51
  ## Older versions of Rubocop:
47
52
 
48
- If you wish to use a version of Rubocop `< 0.36.0` or below, use `gem 'fix-db-schema-conflicts', '~> 1.0.2'`
53
+ If you wish to use a version of Rubocop `< 0.36.0` or below, use `gem 'fix-db-
54
+ schema-conflicts', '~> 1.0.2'`
55
+
56
+ ## Older versions of Ruby:
57
+
58
+ This gem only works with Ruby >= 2.0. Use versions 1.2.2 or below if you have an
59
+ old Ruby.
49
60
 
50
61
  ## Contributing
51
62
 
52
- 1. Fork it ( https://github.com/[my-github-username]/fix-db-schema-conflicts/fork )
63
+ 1. Fork it (https://github.com/[my-github-username]/fix-db-schema-conflicts/fork)
53
64
  2. Create your feature branch (`git checkout -b my-new-feature`)
54
65
  3. Commit your changes (`git commit -am 'Add some feature'`)
55
66
  4. Push to the branch (`git push origin my-new-feature`)
@@ -61,8 +72,14 @@ If you wish to use a version of Rubocop `< 0.36.0` or below, use `gem 'fix-db-sc
61
72
  - @TCampaigne
62
73
  - @Lordnibbler
63
74
  - @timdiggins
75
+ - @zoras
76
+ - @jensljungblad
64
77
 
65
78
  ## Releases
79
+ - 2.0.0
80
+ - Allow usage of Rubocop >= 0.38.0
81
+ - Remove Rails 5 deprecation warnings for using alias_method_chain
82
+ - This upgrade breaks compatibility with Ruby 1.9x since 1.9x lacks #prepend
66
83
  - 1.2.2
67
84
  - Remove dependency on sed
68
85
  - 1.2.1
@@ -24,5 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.add_development_dependency 'rails', '~> 4.2.0'
25
25
  spec.add_development_dependency 'sqlite3', '~> 1.3.0'
26
26
 
27
- spec.add_dependency 'rubocop', '~> 0.38.0'
27
+ spec.add_dependency 'rubocop', '>= 0.38.0'
28
+
29
+ spec.required_ruby_version = '~> 2.0'
28
30
  end
@@ -1,13 +1,7 @@
1
1
  require 'delegate'
2
2
 
3
- module ActiveRecord
4
- # = Active Record Schema Dumper
5
- #
6
- # This class is used to dump the database schema for some connection to some
7
- # output format (i.e., ActiveRecord::Schema).
8
- class SchemaDumper
9
-
10
- private
3
+ module FixDBSchemaConflicts
4
+ module SchemaDumper
11
5
  class ConnectionWithSorting < SimpleDelegator
12
6
  def extensions
13
7
  __getobj__.extensions.sort
@@ -26,21 +20,19 @@ module ActiveRecord
26
20
  end
27
21
  end
28
22
 
29
- def extensions_with_sorting(*args)
23
+ def extensions(*args)
30
24
  with_sorting do
31
- extensions_without_sorting(*args)
25
+ super(*args)
32
26
  end
33
27
  end
34
- alias_method_chain :extensions, :sorting
35
28
 
36
- def table_with_sorting(*args)
29
+ def table(*args)
37
30
  with_sorting do
38
- table_without_sorting(*args)
31
+ super(*args)
39
32
  end
40
33
  end
41
- alias_method_chain :table, :sorting
42
34
 
43
- def with_sorting(&block)
35
+ def with_sorting
44
36
  old, @connection = @connection, ConnectionWithSorting.new(@connection)
45
37
  result = yield
46
38
  @connection = old
@@ -48,3 +40,5 @@ module ActiveRecord
48
40
  end
49
41
  end
50
42
  end
43
+
44
+ ActiveRecord::SchemaDumper.send(:prepend, FixDBSchemaConflicts::SchemaDumper)
@@ -1,3 +1,3 @@
1
1
  module FixDBSchemaConflicts
2
- VERSION='1.2.2'
2
+ VERSION='2.0.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fix-db-schema-conflicts
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jake Moffatt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-28 00:00:00.000000000 Z
11
+ date: 2016-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -84,14 +84,14 @@ dependencies:
84
84
  name: rubocop
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: 0.38.0
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: 0.38.0
97
97
  description: Ensures consistent output of db/schema.rb despite local differences in
@@ -194,9 +194,9 @@ require_paths:
194
194
  - lib
195
195
  required_ruby_version: !ruby/object:Gem::Requirement
196
196
  requirements:
197
- - - ">="
197
+ - - "~>"
198
198
  - !ruby/object:Gem::Version
199
- version: '0'
199
+ version: '2.0'
200
200
  required_rubygems_version: !ruby/object:Gem::Requirement
201
201
  requirements:
202
202
  - - ">="