schema_plus 1.7.1 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +23 -9
  3. data/CHANGELOG.md +6 -0
  4. data/README.md +8 -5
  5. data/gemfiles/Gemfile.base +3 -1
  6. data/gemfiles/{rails-edge → rails-4.2}/Gemfile.base +1 -1
  7. data/gemfiles/{rails-edge → rails-4.2}/Gemfile.mysql2 +1 -1
  8. data/gemfiles/{rails-edge → rails-4.2}/Gemfile.postgresql +1 -1
  9. data/gemfiles/{rails-edge → rails-4.2}/Gemfile.sqlite3 +1 -1
  10. data/lib/schema_plus.rb +7 -0
  11. data/lib/schema_plus/active_record/attribute.rb +19 -0
  12. data/lib/schema_plus/active_record/column_options_handler.rb +17 -2
  13. data/lib/schema_plus/active_record/connection_adapters/abstract_adapter.rb +6 -2
  14. data/lib/schema_plus/active_record/connection_adapters/foreign_key_definition.rb +60 -31
  15. data/lib/schema_plus/active_record/connection_adapters/mysql_adapter.rb +37 -26
  16. data/lib/schema_plus/active_record/connection_adapters/postgresql_adapter.rb +42 -13
  17. data/lib/schema_plus/active_record/connection_adapters/schema_statements.rb +6 -0
  18. data/lib/schema_plus/active_record/connection_adapters/sqlite3_adapter.rb +30 -5
  19. data/lib/schema_plus/active_record/connection_adapters/table_definition.rb +11 -1
  20. data/lib/schema_plus/active_record/foreign_keys.rb +2 -0
  21. data/lib/schema_plus/active_record/migration/command_recorder.rb +3 -0
  22. data/lib/schema_plus/active_record/schema_dumper.rb +12 -2
  23. data/lib/schema_plus/version.rb +1 -1
  24. data/schema_dev.yml +7 -0
  25. data/schema_plus.gemspec +2 -2
  26. data/spec/column_spec.rb +11 -1
  27. data/spec/foreign_key_definition_spec.rb +8 -3
  28. data/spec/schema_dumper_spec.rb +4 -2
  29. data/spec/support/matchers/have_index.rb +1 -0
  30. metadata +21 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b4482f0825b25fe83cd40a915432b6ad80ffd7ba
4
- data.tar.gz: 91a6a499ca49d9a76ee33be36ab3e25e9d94369d
3
+ metadata.gz: 8894d9c9a340bef4433ef8cdafeda27802aea3d7
4
+ data.tar.gz: e9f724492b719a928460d071891af9aa98ab2a9e
5
5
  SHA512:
6
- metadata.gz: 654b22739dde19ab529e5e1517e61f60b6d1ecb9d15a76e5d9baf1b5c50eccf975410409512a0c35327bb4a1dea164a8838fcb137e38e18c596a3284aef938a4
7
- data.tar.gz: 6e3f70498af24d967fe475dfadc9ee85f96731002eadd44eef5857314b5e136660c4f9e2ae7dea5d9cd57a8a6aef33d09efb011ddb5d2490374b782a1dd4a07c
6
+ metadata.gz: 1959ab185f75834d483af81b45009ea13678528bab3f3fdfa9799cb2a136fac56167a6683e31144fded7e26399b6f02f75bc82951ee937d5b1167a83112874cc
7
+ data.tar.gz: ef5155047bc0700c50f0a8d8dee7c8632c0c7c7025ea37ee6181801cf59d5aa316bf23856106e67d9d8742173a8726bf3730df25000dc7fdd5077a6c31d85ac1
@@ -1,8 +1,9 @@
1
1
  # This file was auto-generated by the schema_dev tool, based on the data in
2
- # ./schema_dev.yml
2
+ # ./schema_dev.yml
3
3
  # Please do not edit this file; any changes will be overwritten next time
4
4
  # schema_dev gets run.
5
5
  ---
6
+ sudo: false
6
7
  rvm:
7
8
  - 1.9.3
8
9
  - 2.1.3
@@ -18,29 +19,42 @@ gemfile:
18
19
  - gemfiles/rails-4.1/Gemfile.mysql2
19
20
  - gemfiles/rails-4.1/Gemfile.postgresql
20
21
  - gemfiles/rails-4.1/Gemfile.sqlite3
22
+ - gemfiles/rails-4.2/Gemfile.mysql2
23
+ - gemfiles/rails-4.2/Gemfile.postgresql
24
+ - gemfiles/rails-4.2/Gemfile.sqlite3
25
+ env: POSTGRESQL_DB_USER=postgres MYSQL_DB_USER=travis
21
26
  before_script: bundle exec rake create_databases
22
27
  after_script: bundle exec rake drop_databases
23
- env: POSTGRESQL_DB_USER=postgres MYSQL_DB_USER="travis"
28
+ script: bundle exec rake travis
24
29
  matrix:
25
30
  exclude:
26
31
  - rvm: jruby
27
32
  gemfile: gemfiles/rails-3.2/Gemfile.sqlite3
28
- env: POSTGRESQL_DB_USER=postgres MYSQL_DB_USER="travis"
33
+ env: POSTGRESQL_DB_USER=postgres MYSQL_DB_USER=travis
29
34
  - rvm: jruby
30
35
  gemfile: gemfiles/rails-4.0/Gemfile.mysql2
31
- env: POSTGRESQL_DB_USER=postgres MYSQL_DB_USER="travis"
36
+ env: POSTGRESQL_DB_USER=postgres MYSQL_DB_USER=travis
32
37
  - rvm: jruby
33
38
  gemfile: gemfiles/rails-4.0/Gemfile.postgresql
34
- env: POSTGRESQL_DB_USER=postgres MYSQL_DB_USER="travis"
39
+ env: POSTGRESQL_DB_USER=postgres MYSQL_DB_USER=travis
35
40
  - rvm: jruby
36
41
  gemfile: gemfiles/rails-4.0/Gemfile.sqlite3
37
- env: POSTGRESQL_DB_USER=postgres MYSQL_DB_USER="travis"
42
+ env: POSTGRESQL_DB_USER=postgres MYSQL_DB_USER=travis
38
43
  - rvm: jruby
39
44
  gemfile: gemfiles/rails-4.1/Gemfile.mysql2
40
- env: POSTGRESQL_DB_USER=postgres MYSQL_DB_USER="travis"
45
+ env: POSTGRESQL_DB_USER=postgres MYSQL_DB_USER=travis
41
46
  - rvm: jruby
42
47
  gemfile: gemfiles/rails-4.1/Gemfile.postgresql
43
- env: POSTGRESQL_DB_USER=postgres MYSQL_DB_USER="travis"
48
+ env: POSTGRESQL_DB_USER=postgres MYSQL_DB_USER=travis
44
49
  - rvm: jruby
45
50
  gemfile: gemfiles/rails-4.1/Gemfile.sqlite3
46
- env: POSTGRESQL_DB_USER=postgres MYSQL_DB_USER="travis"
51
+ env: POSTGRESQL_DB_USER=postgres MYSQL_DB_USER=travis
52
+ - rvm: jruby
53
+ gemfile: gemfiles/rails-4.2/Gemfile.mysql2
54
+ env: POSTGRESQL_DB_USER=postgres MYSQL_DB_USER=travis
55
+ - rvm: jruby
56
+ gemfile: gemfiles/rails-4.2/Gemfile.postgresql
57
+ env: POSTGRESQL_DB_USER=postgres MYSQL_DB_USER=travis
58
+ - rvm: jruby
59
+ gemfile: gemfiles/rails-4.2/Gemfile.sqlite3
60
+ env: POSTGRESQL_DB_USER=postgres MYSQL_DB_USER=travis
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## Change Log
4
4
 
5
+ ## 1.8.0
6
+
7
+ * Rails 4.2 now supported. Thanks to [@methodmissing](https://github.com/methodmissing) and [@dimonzozo](https://github.com/dimonzozo)
8
+ * Padrino compatibility. Thanks to [@thmzlt](https://github.com/thmzlt)
9
+ * Internal: Now use our own drop_view function rather than duplicating code. Thanks to [@robertomiranda](https://github.com/robertomiranda)
10
+
5
11
  ### 1.7.1
6
12
 
7
13
  * Eliminate warnings when ruby is in verbose mode
data/README.md CHANGED
@@ -9,15 +9,16 @@ For added rails DRYness see also the gems
9
9
  [schema_associations](http://rubygems.org/gems/schema_associations) and
10
10
  [schema_validations](http://rubygems.org/gems/schema_validations)
11
11
 
12
- [![Gem Version](https://badge.fury.io/rb/schema_plus.png)](http://badge.fury.io/rb/schema_plus)
13
- [![Build Status](https://secure.travis-ci.org/SchemaPlus/schema_plus.png)](http://travis-ci.org/SchemaPlus/schema_plus)
14
- [![Dependency Status](https://gemnasium.com/SchemaPlus/schema_plus.png)](https://gemnasium.com/SchemaPlus/schema_plus)
12
+ [![Gem Version](https://badge.fury.io/rb/schema_plus.svg)](http://badge.fury.io/rb/schema_plus)
13
+ [![Build Status](https://secure.travis-ci.org/SchemaPlus/schema_plus.svg)](http://travis-ci.org/SchemaPlus/schema_plus)
14
+ [![Coverage Status](https://img.shields.io/coveralls/SchemaPlus/schema_plus.svg)](https://coveralls.io/r/SchemaPlus/schema_plus)
15
+ [![Dependency Status](https://gemnasium.com/lomba/schema_plus.svg)](https://gemnasium.com/SchemaPlus/schema_plus)
15
16
 
16
17
  ## Compatibility
17
18
 
18
19
  SchemaPlus supports all combinations of:
19
20
 
20
- * Rails/ActiveRecord 3.2, 4.0, and 4.1
21
+ * Rails/ActiveRecord 3.2, 4.0, 4.1, and 4.2
21
22
  * PostgreSQL, MySQL (using mysql2 gem; mysql gem only supported with Rails
22
23
  3.2), or SQLite3 (using sqlite3 >= 3.7.7 for foreign key support, >= 3.8 for partial indexes)
23
24
  * MRI Ruby >= 1.9.3
@@ -57,7 +58,7 @@ table definition:
57
58
  add_index :parts, :product_code, unique: true
58
59
 
59
60
  But with SchemaPlus you can specify your indexes when you define each column,
60
- with options as desired
61
+ with options as desired. (Rails 4.2 introduced this same capability. Yay! But SchemaPlus still adds some shorthands that aren't in Rails 4.2.)
61
62
 
62
63
  # More DRY way...
63
64
  create_table :parts do |t|
@@ -335,4 +336,6 @@ Schema_plus has a full set of rspec tests. [travis-ci](http://travis-ci.org/Sch
335
336
 
336
337
  $ schema_dev rspec
337
338
 
339
+
338
340
  For more details, see the [schema_dev](https://github.com/SchemaPlus/schema_dev) README.
341
+
@@ -1,4 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
  gemspec :path => File.expand_path('..', __FILE__)
3
3
 
4
- gem "byebug" if RUBY_VERSION > "2"
4
+ platform :ruby do
5
+ gem "byebug" if RUBY_VERSION > "2"
6
+ end
@@ -1,3 +1,3 @@
1
1
  eval File.read File.expand_path('../../Gemfile.base', __FILE__)
2
2
 
3
- gem "rails", "~> 4.0.0"
3
+ gem "rails", "~> 4.2.0"
@@ -7,4 +7,4 @@ end
7
7
 
8
8
  platform :jruby do
9
9
  gem 'activerecord-jdbcmysql-adapter'
10
- end
10
+ end
@@ -7,4 +7,4 @@ end
7
7
 
8
8
  platform :jruby do
9
9
  gem 'activerecord-jdbcpostgresql-adapter'
10
- end
10
+ end
@@ -7,4 +7,4 @@ end
7
7
 
8
8
  platform :jruby do
9
9
  gem 'activerecord-jdbcsqlite3-adapter', '>=1.3.0.beta2'
10
- end
10
+ end
@@ -1,6 +1,8 @@
1
+ require 'active_record'
1
2
  require 'valuable'
2
3
 
3
4
  require 'schema_plus/version'
5
+ require 'schema_plus/active_record/attribute'
4
6
  require 'schema_plus/active_record/base'
5
7
  require 'schema_plus/active_record/column_options_handler'
6
8
  require 'schema_plus/active_record/db_default'
@@ -137,6 +139,10 @@ module SchemaPlus
137
139
  ::ActiveRecord::ConnectionAdapters::AbstractAdapter::SchemaCreation.send(:include, SchemaPlus::ActiveRecord::ConnectionAdapters::AbstractAdapter::VisitTableDefinition)
138
140
  end
139
141
 
142
+ if "#{::ActiveRecord::VERSION::MAJOR}.#{::ActiveRecord::VERSION::MINOR}".to_r >= "4.2".to_r
143
+ require 'active_record/connection_adapters/abstract_mysql_adapter'
144
+ ::ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter::SchemaCreation.send(:include, SchemaPlus::ActiveRecord::ConnectionAdapters::AbstractAdapter::VisitTableDefinition)
145
+ end
140
146
  end
141
147
 
142
148
  def self.insert #:nodoc:
@@ -147,6 +153,7 @@ module SchemaPlus
147
153
  ::ActiveRecord::Schema.send(:include, SchemaPlus::ActiveRecord::Schema)
148
154
  ::ActiveRecord::SchemaDumper.send(:include, SchemaPlus::ActiveRecord::SchemaDumper)
149
155
  ::ActiveRecord.const_set(:DB_DEFAULT, SchemaPlus::ActiveRecord::DB_DEFAULT)
156
+ ::ActiveRecord::Attribute.send(:include, SchemaPlus::ActiveRecord::Attribute) if defined? ::ActiveRecord::Attribute
150
157
  end
151
158
 
152
159
  end
@@ -0,0 +1,19 @@
1
+ module SchemaPlus
2
+ module ActiveRecord
3
+ module Attribute
4
+ def self.included(base)
5
+ base.alias_method_chain :original_value, :schema_plus
6
+ end
7
+
8
+ def original_value_with_schema_plus
9
+ # prevent attempts to cast DB_DEFAULT to the attributes type.
10
+ # We want to keep it as DB_DEFAULT so that we can handle it when
11
+ # generating the sql.
12
+ return DB_DEFAULT if value_before_type_cast == DB_DEFAULT
13
+ original_value_without_schema_plus
14
+ end
15
+
16
+ end
17
+ end
18
+ end
19
+
@@ -1,5 +1,22 @@
1
1
  module SchemaPlus::ActiveRecord
2
2
  module ColumnOptionsHandler
3
+ def schema_plus_normalize_column_options(options)
4
+ # replace some shortcuts with full versions
5
+ case options[:index]
6
+ when true then options[:index] = {}
7
+ when :unique then options[:index] = { :unique => true }
8
+ when Hash
9
+ if options[:index][:length].is_a? Hash
10
+ normalize = if "#{::ActiveRecord::VERSION::MAJOR}.#{::ActiveRecord::VERSION::MINOR}".to_r >= "4.2".to_r
11
+ :stringify_keys!
12
+ else
13
+ :symbolize_keys!
14
+ end
15
+ options[:index][:length].send normalize
16
+ end
17
+ end
18
+ end
19
+
3
20
  def schema_plus_handle_column_options(table_name, column_name, column_options, opts = {}) #:nodoc:
4
21
  config = opts[:config] || SchemaPlus.config
5
22
  fk_args = get_fk_args(table_name, column_name, column_options, config)
@@ -79,8 +96,6 @@ module SchemaPlus::ActiveRecord
79
96
 
80
97
 
81
98
  def column_index(table_name, column_name, options) #:nodoc:
82
- options = {} if options == true
83
- options = { :unique => true } if options == :unique
84
99
  column_name = [column_name] + Array.wrap(options.delete(:with)).compact
85
100
  add_index(table_name, column_name, options)
86
101
  end
@@ -49,7 +49,9 @@ module SchemaPlus
49
49
  # to first drop the view if it already exists.
50
50
  def create_view(view_name, definition, options={})
51
51
  definition = definition.to_sql if definition.respond_to? :to_sql
52
- execute "DROP VIEW IF EXISTS #{quote_table_name(view_name)}" if options[:force]
52
+ if options[:force]
53
+ drop_view(view_name, if_exists: true)
54
+ end
53
55
  execute "CREATE VIEW #{quote_table_name(view_name)} AS #{definition}"
54
56
  end
55
57
 
@@ -84,7 +86,9 @@ module SchemaPlus
84
86
  end
85
87
 
86
88
  def _build_foreign_key(table_name, column_names, references_table_name, references_column_names, options = {}) #:nodoc:
87
- ForeignKeyDefinition.new(options[:name] || ForeignKeyDefinition.default_name(table_name, column_names), table_name, column_names, AbstractAdapter.proper_table_name(references_table_name), references_column_names, options[:on_update], options[:on_delete], options[:deferrable])
89
+ options.merge!(:column_names => column_names, :references_column_names => references_column_names)
90
+ options.reverse_merge!(:name => ForeignKeyDefinition.default_name(table_name, column_names))
91
+ ForeignKeyDefinition.new(table_name, AbstractAdapter.proper_table_name(references_table_name), options)
88
92
  end
89
93
 
90
94
  def self.proper_table_name(name)
@@ -1,3 +1,43 @@
1
+ if "#{::ActiveRecord::VERSION::MAJOR}.#{::ActiveRecord::VERSION::MINOR}".to_r < "4.2".to_r
2
+ class ActiveRecord::ConnectionAdapters::ForeignKeyDefinition < Struct.new(:from_table, :to_table, :options) #:nodoc:
3
+ # The name of the foreign key constraint
4
+ def name
5
+ options[:name]
6
+ end
7
+
8
+ def column
9
+ options[:column]
10
+ end
11
+
12
+ def primary_key
13
+ options[:primary_key] || default_primary_key
14
+ end
15
+
16
+ # The ON_DELETE behavior for the constraint. See above for the
17
+ # possible values.
18
+ def on_delete
19
+ options[:on_delete]
20
+ end
21
+
22
+ # The ON_UPDATE behavior for the constraint. See above for the
23
+ # possible values.
24
+ def on_update
25
+ options[:on_update]
26
+ end
27
+
28
+ def custom_primary_key?
29
+ options[:primary_key] != default_primary_key
30
+ end
31
+
32
+ private
33
+ def default_primary_key
34
+ "id"
35
+ end
36
+ end
37
+ else
38
+ require 'active_record/connection_adapters/abstract/schema_definitions'
39
+ end
40
+
1
41
  module SchemaPlus
2
42
  module ActiveRecord
3
43
  module ConnectionAdapters
@@ -13,48 +53,24 @@ module SchemaPlus
13
53
  # The deferrable attribute can take on the following values:
14
54
  # true
15
55
  # :initially_deferred
16
- class ForeignKeyDefinition
17
-
18
- # The name of the foreign key constraint
19
- attr_reader :name
20
-
21
- # The name of the table the constraint is defined on
22
- attr_reader :table_name
56
+ class ForeignKeyDefinition < ::ActiveRecord::ConnectionAdapters::ForeignKeyDefinition
23
57
 
24
58
  # The list of column names that are constrained (as strings).
25
59
  attr_reader :column_names
26
60
 
27
- # The foreign table that is referenced by the constraint
28
- attr_reader :references_table_name
29
-
30
61
  # The list of column names (as strings) of the foreign table that are referenced
31
62
  # by the constraint
32
63
  attr_reader :references_column_names
33
-
34
- # The ON_UPDATE behavior for the constraint. See above for the
35
- # possible values.
36
- attr_reader :on_update
37
-
38
- # The ON_DELETE behavior for the constraint. See above for the
39
- # possible values.
40
- attr_reader :on_delete
41
-
42
- # True if the constraint is deferrable
43
- attr_reader :deferrable
44
-
45
64
  # :enddoc:
46
65
 
47
66
  ACTIONS = { :cascade => "CASCADE", :restrict => "RESTRICT", :set_null => "SET NULL", :set_default => "SET DEFAULT", :no_action => "NO ACTION" }.freeze
48
67
 
49
- def initialize(name, table_name, column_names, references_table_name, references_column_names, on_update = nil, on_delete = nil, deferrable = nil)
50
- @name = name
51
- @table_name = unquote(table_name)
52
- @column_names = unquote(Array.wrap(column_names))
53
- @references_table_name = unquote(references_table_name)
54
- @references_column_names = unquote(Array.wrap(references_column_names))
55
- @on_update = on_update
56
- @on_delete = on_delete
57
- @deferrable = deferrable
68
+ def initialize(from_table, to_table, options)
69
+ super
70
+ @from_table = unquote(from_table)
71
+ @to_table = unquote(to_table)
72
+ @column_names = unquote(Array.wrap(options.delete(:column_names)))
73
+ @references_column_names = unquote(Array.wrap(options.delete(:references_column_names)))
58
74
 
59
75
  ACTIONS.has_key?(on_update) or raise(ArgumentError, "invalid :on_update action: #{on_update.inspect}") if on_update
60
76
  ACTIONS.has_key?(on_delete) or raise(ArgumentError, "invalid :on_delete action: #{on_delete.inspect}") if on_delete
@@ -64,6 +80,19 @@ module SchemaPlus
64
80
  end
65
81
  end
66
82
 
83
+ def table_name
84
+ from_table
85
+ end
86
+
87
+ def references_table_name
88
+ to_table
89
+ end
90
+
91
+ # True if the constraint is deferrable
92
+ def deferrable
93
+ options[:deferrable]
94
+ end
95
+
67
96
  # Dumps a definition of foreign key.
68
97
  def to_dump(opts={})
69
98
  dump = (opts[:inline] ? " t.foreign_key" : "add_foreign_key #{table_name.inspect},")
@@ -59,12 +59,18 @@ module SchemaPlus
59
59
 
60
60
  # implement cascade by removing foreign keys
61
61
  def drop_table(name, options={})
62
- reverse_foreign_keys(name).each{ |foreign_key| remove_foreign_key(foreign_key.table_name, foreign_key.name) } if options[:cascade]
63
- sql = "DROP"
64
- sql += " TEMPORARY" if options[:temporary]
65
- sql += " TABLE"
66
- sql += " IF EXISTS" if options[:if_exists]
62
+ if options[:cascade]
63
+ reverse_foreign_keys(name).each do |foreign_key|
64
+ remove_foreign_key(foreign_key.table_name, foreign_key.name)
65
+ end
66
+ end
67
+
68
+ sql = 'DROP'
69
+ sql += ' TEMPORARY' if options[:temporary]
70
+ sql += ' TABLE'
71
+ sql += ' IF EXISTS' if options[:if_exists]
67
72
  sql += " #{quote_table_name(name)}"
73
+
68
74
  execute sql
69
75
  end
70
76
 
@@ -108,10 +114,15 @@ module SchemaPlus
108
114
  on_update = on_update ? on_update.downcase.gsub(' ', '_').to_sym : :restrict
109
115
  on_delete = on_delete ? on_delete.downcase.gsub(' ', '_').to_sym : :restrict
110
116
 
111
- foreign_keys << ForeignKeyDefinition.new(name,
112
- namespace_prefix + table_name, column_names.gsub('`', '').split(', '),
113
- references_table_name, references_column_names.gsub('`', '').split(', '),
114
- on_update, on_delete)
117
+ options = { :name => name,
118
+ :on_delete => on_delete,
119
+ :on_update => on_update,
120
+ :column_names => column_names.gsub('`', '').split(', '),
121
+ :references_column_names => references_column_names.gsub('`', '').split(', ') }
122
+
123
+ foreign_keys << ForeignKeyDefinition.new(namespace_prefix + table_name,
124
+ references_table_name,
125
+ options)
115
126
  end
116
127
  end
117
128
  end
@@ -127,27 +138,27 @@ module SchemaPlus
127
138
  AND referenced_table_schema = table_schema
128
139
  ORDER BY constraint_name, ordinal_position;
129
140
  SQL
130
- current_foreign_key = nil
131
- foreign_keys = []
132
-
133
- namespace_prefix = table_namespace_prefix(table_name)
134
141
 
135
- results.each do |row|
136
- next unless table_name_without_namespace(table_name).casecmp(row["referenced_table_name"]) == 0
137
- if current_foreign_key != row["constraint_name"]
138
- referenced_table_name = row["table_name"]
139
- referenced_table_name = namespace_prefix + referenced_table_name if table_namespace_prefix(referenced_table_name).blank?
140
- references_table_name = row["referenced_table_name"]
141
- references_table_name = namespace_prefix + references_table_name if table_namespace_prefix(references_table_name).blank?
142
- foreign_keys << ForeignKeyDefinition.new(row["constraint_name"], referenced_table_name, [], references_table_name, [])
143
- current_foreign_key = row["constraint_name"]
144
- end
142
+ constraints = results.to_a.group_by do |r|
143
+ r.values_at('constraint_name', 'table_name', 'referenced_table_name')
144
+ end
145
145
 
146
- foreign_keys.last.column_names << row["column_name"]
147
- foreign_keys.last.references_column_names << row["referenced_column_name"]
146
+ from_table_constraints = constraints.select do |(_, _, to_table), _|
147
+ table_name_without_namespace(table_name).casecmp(to_table) == 0
148
148
  end
149
149
 
150
- foreign_keys
150
+ from_table_constraints.map do |(constraint_name, from_table, to_table), columns|
151
+ from_table = table_namespace_prefix(from_table) + from_table
152
+ to_table = table_namespace_prefix(to_table) + to_table
153
+
154
+ options = {
155
+ :name => constraint_name,
156
+ :column_names => columns.map { |row| row['column_name'] },
157
+ :references_column_names => columns.map { |row| row['referenced_column_name'] }
158
+ }
159
+
160
+ ForeignKeyDefinition.new(from_table, to_table, options)
161
+ end
151
162
  end
152
163
 
153
164
  def views(name = nil)
@@ -9,22 +9,38 @@ module SchemaPlus
9
9
  if defined?(JRUBY_VERSION)
10
10
  base.alias_method_chain :default_value, :schema_plus
11
11
  else
12
- base.class_eval do
13
- class << self
14
- alias_method_chain :extract_value_from_default, :schema_plus
12
+ if "#{::ActiveRecord::VERSION::MAJOR}.#{::ActiveRecord::VERSION::MINOR}".to_r < "4.2".to_r
13
+ base.class_eval do
14
+ class << self
15
+ alias_method_chain :extract_value_from_default, :schema_plus
16
+ end
15
17
  end
16
18
  end
17
19
  end
18
20
  end
19
21
 
20
- def initialize(name, default, sql_type = nil, null = true)
21
- if default.is_a? Hash
22
- if default[:expr]
23
- @default_expr = default[:expr]
22
+ if "#{::ActiveRecord::VERSION::MAJOR}.#{::ActiveRecord::VERSION::MINOR}".to_r <= "4.1".to_r
23
+ def initialize(name, default, sql_type = nil, null = true)
24
+ if default.is_a? Hash
25
+ if default[:expr]
26
+ @default_expr = default[:expr]
27
+ end
28
+ default = nil
24
29
  end
25
- default = nil
30
+ super(name, default, sql_type, null)
31
+ end
32
+ else
33
+ def initialize(name, default, cast_type, sql_type = nil, null = true, default_function = nil)
34
+ if sql_type =~ /\[\]$/
35
+ @array = true
36
+ super(name, default, cast_type, sql_type[0..sql_type.length - 3], null)
37
+ else
38
+ @array = false
39
+ super(name, default, cast_type, sql_type, null)
40
+ end
41
+
42
+ @default_function = @default_expr = default_function
26
43
  end
27
- super(name, default, sql_type, null)
28
44
  end
29
45
 
30
46
  def default_value_with_schema_plus(default)
@@ -87,6 +103,7 @@ module SchemaPlus
87
103
  options = {} if options.nil? # some callers explicitly pass options=nil
88
104
  column_name, options = [], column_name if column_name.is_a?(Hash)
89
105
  column_names = Array(column_name).compact
106
+ column_names += Array(options[:with] || [])
90
107
  if column_names.empty?
91
108
  raise ArgumentError, "No columns and :expression missing from options - cannot create index" unless options[:expression]
92
109
  raise ArgumentError, "Index name not given. Pass :name option" unless options[:name]
@@ -352,6 +369,12 @@ module SchemaPlus
352
369
  execute "DROP TYPE #{enum_name(name, options[:schema])}"
353
370
  end
354
371
 
372
+ # pg gem defines a drop_table with fewer options than our Abstract
373
+ # one, so use the abstract one instead
374
+ def drop_table(name, options={})
375
+ SchemaPlus::ActiveRecord::ConnectionAdapters::AbstractAdapter.instance_method(:drop_table).bind(self).call(name, options)
376
+ end
377
+
355
378
  private
356
379
 
357
380
  def enum_name(name, schema)
@@ -390,10 +413,16 @@ module SchemaPlus
390
413
  on_update = on_update ? on_update.downcase.gsub(' ', '_').to_sym : :no_action
391
414
  on_delete = on_delete ? on_delete.downcase.gsub(' ', '_').to_sym : :no_action
392
415
 
393
- foreign_keys << ForeignKeyDefinition.new(name,
394
- from_table_name, column_names.split(', '),
395
- references_table_name.sub(/^"(.*)"$/, '\1'), references_column_names.split(', '),
396
- on_update, on_delete, deferrable)
416
+ options = { :name => name,
417
+ :on_delete => on_delete,
418
+ :on_update => on_update,
419
+ :column_names => column_names.split(', '),
420
+ :references_column_names => references_column_names.split(', '),
421
+ :deferrable => deferrable }
422
+
423
+ foreign_keys << ForeignKeyDefinition.new(from_table_name,
424
+ references_table_name.sub(/^"(.*)"$/, '\1'),
425
+ options)
397
426
  end
398
427
  end
399
428
 
@@ -5,6 +5,7 @@ module SchemaPlus::ActiveRecord::ConnectionAdapters
5
5
  base.class_eval do
6
6
  alias_method_chain :create_table, :schema_plus
7
7
  alias_method_chain :add_reference, :schema_plus unless ::ActiveRecord::VERSION::MAJOR.to_i < 4
8
+ alias_method_chain :add_index_options, :schema_plus if "#{::ActiveRecord::VERSION::MAJOR}.#{::ActiveRecord::VERSION::MINOR}".to_r >= "4.2".to_r
8
9
  include AddIndex
9
10
  end
10
11
  end
@@ -52,6 +53,11 @@ module SchemaPlus::ActiveRecord::ConnectionAdapters
52
53
  end
53
54
  end
54
55
 
56
+ def add_index_options_with_schema_plus(table_name, column_name, options = {})
57
+ columns = options.delete(:with) { |_| [] }
58
+ add_index_options_without_schema_plus(table_name, Array(column_name).concat(Array(columns).map(&:to_s)), options)
59
+ end
60
+
55
61
  def self.add_index_exception_handler(connection, table, columns, options, e) #:nodoc:
56
62
  raise unless e.message.match(/["']([^"']+)["'].*already exists/)
57
63
  name = $1
@@ -8,6 +8,16 @@ module SchemaPlus
8
8
  end
9
9
  super(name, default, sql_type, null)
10
10
  end
11
+
12
+ # AR 4.2 uses default_function rather than default_expr
13
+ def self.included(base)
14
+ base.alias_method_chain :default_function, :sqlite3 if base.instance_methods.include? :default_function
15
+ end
16
+
17
+ def default_function_with_sqlite3
18
+ @default_function ||= "(#{default})" if default =~ /DATETIME/
19
+ default_function_without_sqlite3
20
+ end
11
21
  end
12
22
 
13
23
  # SchemaPlus includes an Sqlite3 implementation of the AbstractAdapter
@@ -20,12 +30,15 @@ module SchemaPlus
20
30
  base.class_eval do
21
31
  alias_method_chain :indexes, :schema_plus
22
32
  alias_method_chain :rename_table, :schema_plus
33
+ alias_method_chain :tables, :schema_plus
23
34
  end
24
35
 
25
36
  if ::ActiveRecord::VERSION::MAJOR.to_i < 4
26
37
  ::ActiveRecord::ConnectionAdapters::SQLiteColumn.send(:include, SQLiteColumn) unless ::ActiveRecord::ConnectionAdapters::SQLiteColumn.include?(SQLiteColumn)
27
- else
38
+ elsif defined? ::ActiveRecord::ConnectionAdapters::SQLite3Column
28
39
  ::ActiveRecord::ConnectionAdapters::SQLite3Column.send(:include, SQLiteColumn) unless ::ActiveRecord::ConnectionAdapters::SQLite3Column.include?(SQLiteColumn)
40
+ else # in ActiveRecord::VERSION 4.2 there's no SQLite3Column
41
+ ::ActiveRecord::ConnectionAdapters::Column.send(:include, SQLiteColumn) unless ::ActiveRecord::ConnectionAdapters::Column.include?(SQLiteColumn)
29
42
  end
30
43
  end
31
44
 
@@ -84,6 +97,11 @@ module SchemaPlus
84
97
  get_foreign_keys(nil, name).select{|definition| definition.references_table_name == table_name}
85
98
  end
86
99
 
100
+ def tables_with_schema_plus(*args)
101
+ # AR 4.2 explicitly looks for views or tables, but only for sqlite3. so take away the tables.
102
+ tables_without_schema_plus(*args) - views
103
+ end
104
+
87
105
  def views(name = nil)
88
106
  execute("SELECT name FROM sqlite_master WHERE type='view'", name).collect{|row| row["name"]}
89
107
  end
@@ -121,10 +139,17 @@ module SchemaPlus
121
139
  on_update = on_update ? on_update.downcase.gsub(' ', '_').to_sym : :no_action
122
140
  on_delete = on_delete ? on_delete.downcase.gsub(' ', '_').to_sym : :no_action
123
141
  deferrable = deferrable ? (initially_deferred ? :initially_deferred : true) : false
124
- foreign_keys << ForeignKeyDefinition.new(name,
125
- table_name, column_names,
126
- references_table_name, references_column_names,
127
- on_update, on_delete, deferrable)
142
+
143
+ options = { :name => name,
144
+ :on_update => on_update,
145
+ :on_delete => on_delete,
146
+ :column_names => column_names,
147
+ :references_column_names => references_column_names,
148
+ :deferrable => deferrable }
149
+
150
+ foreign_keys << ForeignKeyDefinition.new(table_name,
151
+ references_table_name,
152
+ options)
128
153
  end
129
154
  end
130
155
 
@@ -109,6 +109,7 @@ module SchemaPlus::ActiveRecord::ConnectionAdapters
109
109
  def references_with_schema_plus(*args) #:nodoc:
110
110
  options = args.extract_options!
111
111
  options[:references] = nil if options[:polymorphic]
112
+ schema_plus_normalize_column_options(options)
112
113
  options[:_index] = options.delete(:index) unless options[:polymorphic] # usurp index creation from AR
113
114
  args << options
114
115
  references_without_schema_plus(*args)
@@ -119,13 +120,20 @@ module SchemaPlus::ActiveRecord::ConnectionAdapters
119
120
  def belongs_to_with_schema_plus(*args) #:nodoc:
120
121
  options = args.extract_options!
121
122
  options[:references] = nil if options[:polymorphic]
123
+ schema_plus_normalize_column_options(options)
122
124
  options[:_index] = options.delete(:index) unless options[:polymorphic] # usurp index creation from AR
123
125
  args << options
124
126
  belongs_to_without_schema_plus(*args)
125
127
  end
126
128
 
127
129
  def column_with_schema_plus(name, type, options = {}) #:nodoc:
130
+ schema_plus_normalize_column_options(options)
131
+ # prevent AR from seeing :index => false as a request for an index
132
+ if noindex = options[:index] == false
133
+ options.delete(:index)
134
+ end
128
135
  column_without_schema_plus(name, type, options)
136
+ options[:index] = false if noindex
129
137
  schema_plus_handle_column_options(self.name, name, options, :config => schema_plus_config)
130
138
  self
131
139
  end
@@ -144,7 +152,9 @@ module SchemaPlus::ActiveRecord::ConnectionAdapters
144
152
  end
145
153
 
146
154
  def foreign_key(column_names, references_table_name, references_column_names, options = {})
147
- @foreign_keys << ForeignKeyDefinition.new(options[:name] || ForeignKeyDefinition.default_name(self.name, column_names), self.name, column_names, AbstractAdapter.proper_table_name(references_table_name), references_column_names, options[:on_update], options[:on_delete], options[:deferrable])
155
+ options.merge!(:column_names => column_names, :references_column_names => references_column_names)
156
+ options.reverse_merge!(:name => ForeignKeyDefinition.default_name(self.name, column_names))
157
+ @foreign_keys << ForeignKeyDefinition.new(self.name, AbstractAdapter.proper_table_name(references_table_name), options)
148
158
  self
149
159
  end
150
160
 
@@ -121,12 +121,14 @@ module SchemaPlus::ActiveRecord
121
121
  # automatically create an index for foreign keys if you don't.)
122
122
  #
123
123
  def add_column(table_name, column_name, type, options = {})
124
+ schema_plus_normalize_column_options(options)
124
125
  super
125
126
  schema_plus_handle_column_options(table_name, column_name, options)
126
127
  end
127
128
 
128
129
  # Enhances ActiveRecord::Migration#change_column to support indexes and foreign keys same as add_column.
129
130
  def change_column(table_name, column_name, type, options = {})
131
+ schema_plus_normalize_column_options(options)
130
132
  super
131
133
  schema_plus_handle_column_options(table_name, column_name, options)
132
134
  end
@@ -11,10 +11,12 @@ module SchemaPlus
11
11
  alias_method_chain :add_column, :schema_plus
12
12
  alias_method_chain :add_reference, :schema_plus unless ::ActiveRecord::VERSION::MAJOR.to_i < 4
13
13
  alias_method_chain :invert_add_index, :schema_plus
14
+ alias_method_chain :invert_add_foreign_key, :schema_plus if "#{::ActiveRecord::VERSION::MAJOR}.#{::ActiveRecord::VERSION::MINOR}".to_r >= "4.2".to_r
14
15
  end
15
16
  end
16
17
 
17
18
  def add_column_with_schema_plus(table_name, name, type, options = {}) #:nodoc:
19
+ schema_plus_normalize_column_options(options)
18
20
  add_column_without_schema_plus(table_name, name, type, options)
19
21
  revertable_schema_plus_handle_column_options(table_name, name, options, :config => schema_plus_config)
20
22
  self
@@ -69,6 +71,7 @@ module SchemaPlus
69
71
  table_name, column_names, references_table_name, references_column_names, options = args
70
72
  [:remove_foreign_key, [table_name, column_names, references_table_name, references_column_names, (options||{}).merge(if_exists: true)]]
71
73
  end
74
+ alias :invert_add_foreign_key_with_schema_plus :invert_add_foreign_key
72
75
 
73
76
  def invert_add_index_with_schema_plus(args)
74
77
  table, columns, options = *args
@@ -59,7 +59,11 @@ module SchemaPlus
59
59
  end
60
60
  end
61
61
 
62
+ if "#{::ActiveRecord::VERSION::MAJOR}.#{::ActiveRecord::VERSION::MINOR}".to_r < "4.2".to_r
62
63
  tables_without_schema_plus(nil)
64
+ else
65
+ tables_without_schema_plus(stream)
66
+ end
63
67
 
64
68
  @connection.views.each do |view_name|
65
69
  next if Array.wrap(::ActiveRecord::SchemaDumper.ignore_tables).any? {|pattern| view_name.match pattern}
@@ -114,8 +118,14 @@ module SchemaPlus
114
118
  table_without_schema_plus(table, stream)
115
119
  stream_string = stream.string
116
120
  @connection.columns(table).each do |column|
117
- if !column.default_expr.nil?
118
- stream_string.gsub!("\"#{column.name}\"", "\"#{column.name}\", :default => { :expr => #{column.default_expr.inspect} }")
121
+ if "#{::ActiveRecord::VERSION::MAJOR}.#{::ActiveRecord::VERSION::MINOR}".to_r < "4.2".to_r
122
+ if !column.default_expr.nil?
123
+ stream_string.gsub!("\"#{column.name}\"", "\"#{column.name}\", :default => { :expr => #{column.default_expr.inspect} }")
124
+ end
125
+ else
126
+ if !column.default_function.nil?
127
+ stream_string.gsub!("\"#{column.name}\"", "\"#{column.name}\", :default => { :expr => #{column.default_function.inspect} }")
128
+ end
119
129
  end
120
130
  end
121
131
  @table_dumps[table] = stream_string
@@ -1,3 +1,3 @@
1
1
  module SchemaPlus
2
- VERSION = "1.7.1"
2
+ VERSION = "1.8.0"
3
3
  end
@@ -6,6 +6,7 @@ rails:
6
6
  - 3.2
7
7
  - 4.0
8
8
  - 4.1
9
+ - 4.2
9
10
  db:
10
11
  - mysql
11
12
  - mysql2
@@ -18,12 +19,18 @@ exclude:
18
19
  -
19
20
  rails: 4.1
20
21
  db: mysql
22
+ -
23
+ rails: 4.2
24
+ db: mysql
21
25
  -
22
26
  ruby: jruby
23
27
  rails: 4.0
24
28
  -
25
29
  ruby: jruby
26
30
  rails: 4.1
31
+ -
32
+ ruby: jruby
33
+ rails: 4.2
27
34
  -
28
35
  ruby: jruby
29
36
  db: sqlite3
@@ -21,10 +21,10 @@ Gem::Specification.new do |s|
21
21
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
22
22
  s.require_paths = ["lib"]
23
23
 
24
- s.add_dependency("activerecord", ">= 3.2")
24
+ s.add_dependency("activerecord", ">= 3.2", "< 4.3")
25
25
  s.add_dependency("valuable")
26
26
 
27
- s.add_development_dependency("schema_dev", "~> 0.1")
27
+ s.add_development_dependency("schema_dev", "~> 1.2", ">= 1.2.5")
28
28
  s.add_development_dependency("rake")
29
29
  s.add_development_dependency("rspec", "~> 3.0.0")
30
30
  s.add_development_dependency("rdoc")
@@ -14,7 +14,17 @@ describe "Column" do
14
14
  @login = User.columns.find{|column| column.name == "login"}
15
15
  end
16
16
  it "works properly" do
17
- expect(JSON.parse(@login.to_json)).to include("name" => "login", "type" => "string")
17
+ type = case
18
+ when "#{::ActiveRecord::VERSION::MAJOR}.#{::ActiveRecord::VERSION::MINOR}".to_r <= "4.1".to_r
19
+ { "type" => "string" }
20
+ when SchemaDev::Rspec::Helpers.mysql?
21
+ { "sql_type" => "varchar(255)" }
22
+ when SchemaDev::Rspec::Helpers.postgresql?
23
+ { "sql_type" => "character varying" }
24
+ when SchemaDev::Rspec::Helpers.sqlite3?
25
+ { "sql_type" => "varchar" }
26
+ end
27
+ expect(JSON.parse(@login.to_json)).to include(type.merge("name" => "login"))
18
28
  end
19
29
  end
20
30
 
@@ -2,19 +2,24 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
2
 
3
3
  describe "Foreign Key definition" do
4
4
 
5
- let(:definition) { SchemaPlus::ActiveRecord::ConnectionAdapters::ForeignKeyDefinition.new("posts_user_fkey", :posts, :user, :users, :id) }
5
+ let(:definition) {
6
+ options = {:name => "posts_user_fkey", :column_names => :user, :references_column_names => :id}
7
+ SchemaPlus::ActiveRecord::ConnectionAdapters::ForeignKeyDefinition.new(:posts, :users, options)
8
+ }
6
9
 
7
10
  it "dumps to sql with quoted values" do
8
11
  expect(definition.to_sql).to eq(%Q{CONSTRAINT posts_user_fkey FOREIGN KEY (#{quote_column_name('user')}) REFERENCES #{quote_table_name('users')} (#{quote_column_name('id')})})
9
12
  end
10
13
 
11
14
  it "dumps to sql with deferrable values" do
12
- deferred_definition = SchemaPlus::ActiveRecord::ConnectionAdapters::ForeignKeyDefinition.new("posts_user_fkey", :posts, :user, :users, :id, nil, nil, true)
15
+ options = {:name => "posts_user_fkey", :column_names => :user, :references_column_names => :id, :deferrable => true}
16
+ deferred_definition = SchemaPlus::ActiveRecord::ConnectionAdapters::ForeignKeyDefinition.new(:posts, :users, options)
13
17
  expect(deferred_definition.to_sql).to eq(%Q{CONSTRAINT posts_user_fkey FOREIGN KEY (#{quote_column_name('user')}) REFERENCES #{quote_table_name('users')} (#{quote_column_name('id')}) DEFERRABLE})
14
18
  end
15
19
 
16
20
  it "dumps to sql with initially deferrable values" do
17
- initially_deferred_definition = SchemaPlus::ActiveRecord::ConnectionAdapters::ForeignKeyDefinition.new("posts_user_fkey", :posts, :user, :users, :id, nil, nil, :initially_deferred)
21
+ options = {:name => "posts_user_fkey", :column_names => :user, :references_column_names => :id, :deferrable => :initially_deferred}
22
+ initially_deferred_definition = SchemaPlus::ActiveRecord::ConnectionAdapters::ForeignKeyDefinition.new(:posts, :users, options)
18
23
  expect(initially_deferred_definition.to_sql).to eq(%Q{CONSTRAINT posts_user_fkey FOREIGN KEY (#{quote_column_name('user')}) REFERENCES #{quote_table_name('users')} (#{quote_column_name('id')}) DEFERRABLE INITIALLY DEFERRED})
19
24
  end
20
25
 
@@ -96,7 +96,7 @@ describe "Schema dump" do
96
96
 
97
97
  it "should dump the default hash expr as CURRENT_TIMESTAMP" do
98
98
  with_additional_column Post, :posted_at, :datetime, :default => {:expr => 'date \'2001-09-28\''} do
99
- expect(dump_posts).to match(%r{t\.datetime\s+"posted_at",\s*(?:default:|:default =>)\s*'2001-09-28 00:00:00'})
99
+ expect(dump_posts).to match(%r{t\.datetime\s+"posted_at",\s*(?:default:|:default =>).*2001-09-28.*})
100
100
  end
101
101
  end
102
102
 
@@ -131,7 +131,9 @@ describe "Schema dump" do
131
131
  ActiveRecord::Migration.suppress_messages do
132
132
  ActiveRecord::Migration.change_column_default :posts, :string_no_default, nil
133
133
  end
134
- expect(dump_posts).to match(%r{t\.string\s+"string_no_default"\s*$})
134
+ # mysql2 includes 'limit: 255' in the output. that's OK, just want to
135
+ # make sure the full line doesn't have 'default' in it.
136
+ expect(dump_posts).to match(%r{t\.string\s+"string_no_default"\s*(,\s*limit:\s*\d+)?$})
135
137
  end
136
138
 
137
139
  it "should include foreign_key options" do
@@ -9,6 +9,7 @@ module SchemaPlusMatchers
9
9
  end
10
10
 
11
11
  def matches?(model)
12
+ @too_many = nil
12
13
  @model = model
13
14
  indexes = @model.indexes.select { |index| index.columns.to_set == @required_columns }
14
15
  if indexes.length > 1
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: schema_plus
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.1
4
+ version: 1.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ronen Barzel
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-12-07 00:00:00.000000000 Z
12
+ date: 2014-12-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -18,6 +18,9 @@ dependencies:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
20
  version: '3.2'
21
+ - - "<"
22
+ - !ruby/object:Gem::Version
23
+ version: '4.3'
21
24
  type: :runtime
22
25
  prerelease: false
23
26
  version_requirements: !ruby/object:Gem::Requirement
@@ -25,6 +28,9 @@ dependencies:
25
28
  - - ">="
26
29
  - !ruby/object:Gem::Version
27
30
  version: '3.2'
31
+ - - "<"
32
+ - !ruby/object:Gem::Version
33
+ version: '4.3'
28
34
  - !ruby/object:Gem::Dependency
29
35
  name: valuable
30
36
  requirement: !ruby/object:Gem::Requirement
@@ -45,14 +51,20 @@ dependencies:
45
51
  requirements:
46
52
  - - "~>"
47
53
  - !ruby/object:Gem::Version
48
- version: '0.1'
54
+ version: '1.2'
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: 1.2.5
49
58
  type: :development
50
59
  prerelease: false
51
60
  version_requirements: !ruby/object:Gem::Requirement
52
61
  requirements:
53
62
  - - "~>"
54
63
  - !ruby/object:Gem::Version
55
- version: '0.1'
64
+ version: '1.2'
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: 1.2.5
56
68
  - !ruby/object:Gem::Dependency
57
69
  name: rake
58
70
  requirement: !ruby/object:Gem::Requirement
@@ -169,13 +181,14 @@ files:
169
181
  - gemfiles/rails-4.1/Gemfile.mysql2
170
182
  - gemfiles/rails-4.1/Gemfile.postgresql
171
183
  - gemfiles/rails-4.1/Gemfile.sqlite3
172
- - gemfiles/rails-edge/Gemfile.base
173
- - gemfiles/rails-edge/Gemfile.mysql2
174
- - gemfiles/rails-edge/Gemfile.postgresql
175
- - gemfiles/rails-edge/Gemfile.sqlite3
184
+ - gemfiles/rails-4.2/Gemfile.base
185
+ - gemfiles/rails-4.2/Gemfile.mysql2
186
+ - gemfiles/rails-4.2/Gemfile.postgresql
187
+ - gemfiles/rails-4.2/Gemfile.sqlite3
176
188
  - init.rb
177
189
  - lib/rails/tasks/database.rake
178
190
  - lib/schema_plus.rb
191
+ - lib/schema_plus/active_record/attribute.rb
179
192
  - lib/schema_plus/active_record/base.rb
180
193
  - lib/schema_plus/active_record/column_options_handler.rb
181
194
  - lib/schema_plus/active_record/connection_adapters/abstract_adapter.rb