schema_plus 1.8.9 → 2.0.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +4 -4
  3. data/.travis.yml +1 -47
  4. data/CHANGELOG.md +0 -35
  5. data/README.md +73 -107
  6. data/Rakefile +7 -10
  7. data/TODO.md +51 -0
  8. data/gemfiles/Gemfile.base +2 -0
  9. data/lib/schema_column_plus.rb +7 -0
  10. data/lib/{schema_plus → schema_column_plus}/active_record/connection_adapters/column.rb +13 -11
  11. data/lib/schema_column_plus/middleware/model.rb +22 -0
  12. data/lib/schema_db_default.rb +13 -0
  13. data/lib/{schema_plus → schema_db_default}/active_record/attribute.rb +4 -4
  14. data/lib/schema_db_default/db_default.rb +17 -0
  15. data/lib/schema_db_default/middleware.rb +30 -0
  16. data/lib/schema_default_expr.rb +32 -0
  17. data/lib/schema_default_expr/active_record/connection_adapters/mysql_adapter.rb +17 -0
  18. data/lib/schema_default_expr/active_record/connection_adapters/postgresql_adapter.rb +18 -0
  19. data/lib/schema_default_expr/active_record/connection_adapters/sqlite3_adapter.rb +35 -0
  20. data/lib/schema_default_expr/middleware.rb +54 -0
  21. data/lib/schema_pg_enums.rb +6 -0
  22. data/lib/schema_pg_enums/active_record.rb +69 -0
  23. data/lib/schema_pg_enums/middleware.rb +23 -0
  24. data/lib/schema_plus.rb +17 -45
  25. data/lib/schema_plus/active_record/base.rb +6 -23
  26. data/lib/schema_plus/active_record/connection_adapters/abstract_adapter.rb +80 -181
  27. data/lib/schema_plus/active_record/connection_adapters/foreign_key_definition.rb +78 -99
  28. data/lib/schema_plus/active_record/connection_adapters/mysql_adapter.rb +34 -114
  29. data/lib/schema_plus/active_record/connection_adapters/postgresql_adapter.rb +16 -370
  30. data/lib/schema_plus/active_record/connection_adapters/schema_statements.rb +1 -67
  31. data/lib/schema_plus/active_record/connection_adapters/sqlite3_adapter.rb +18 -112
  32. data/lib/schema_plus/active_record/connection_adapters/table_definition.rb +14 -116
  33. data/lib/schema_plus/active_record/migration/command_recorder.rb +8 -59
  34. data/lib/schema_plus/middleware/dumper.rb +94 -0
  35. data/lib/schema_plus/middleware/migration.rb +167 -0
  36. data/lib/schema_plus/middleware/model.rb +17 -0
  37. data/lib/schema_plus/version.rb +1 -1
  38. data/lib/schema_plus_tables.rb +15 -0
  39. data/lib/schema_plus_tables/active_record/connection_adapters/abstract_adapter.rb +20 -0
  40. data/lib/schema_plus_tables/active_record/connection_adapters/mysql_adapter.rb +25 -0
  41. data/lib/schema_plus_tables/active_record/connection_adapters/postgresql_adapter.rb +13 -0
  42. data/lib/schema_plus_tables/active_record/connection_adapters/sqlite3_adapter.rb +12 -0
  43. data/lib/schema_views.rb +16 -0
  44. data/lib/schema_views/active_record/connection_adapters/abstract_adapter.rb +41 -0
  45. data/lib/schema_views/active_record/connection_adapters/mysql_adapter.rb +30 -0
  46. data/lib/schema_views/active_record/connection_adapters/postgresql_adapter.rb +31 -0
  47. data/lib/schema_views/active_record/connection_adapters/sqlite3_adapter.rb +18 -0
  48. data/lib/schema_views/middleware.rb +47 -0
  49. data/schema_dev.yml +1 -31
  50. data/schema_plus.gemspec +11 -9
  51. data/spec/foreign_key_definition_spec.rb +7 -7
  52. data/spec/foreign_key_spec.rb +63 -48
  53. data/spec/migration_spec.rb +58 -203
  54. data/spec/named_schemas_spec.rb +5 -88
  55. data/spec/{column_spec.rb → schema_column_plus/column_spec.rb} +26 -48
  56. data/spec/schema_db_default/column_spec.rb +58 -0
  57. data/spec/{column_default_spec.rb → schema_default_expr/column_default_spec.rb} +1 -2
  58. data/spec/schema_default_expr/schema_dumper_spec.rb +116 -0
  59. data/spec/schema_dumper_spec.rb +22 -327
  60. data/spec/{enum_spec.rb → schema_pg_enums/enum_spec.rb} +1 -1
  61. data/spec/schema_pg_enums/schema_dumper_spec.rb +37 -0
  62. data/spec/schema_views/named_schemas_spec.rb +97 -0
  63. data/spec/{views_spec.rb → schema_views/views_spec.rb} +1 -1
  64. data/spec/spec_helper.rb +2 -1
  65. data/spec/support/matchers/reference.rb +11 -12
  66. metadata +104 -57
  67. data/gemfiles/rails-3.2/Gemfile.base +0 -3
  68. data/gemfiles/rails-3.2/Gemfile.mysql +0 -10
  69. data/gemfiles/rails-3.2/Gemfile.mysql2 +0 -10
  70. data/gemfiles/rails-3.2/Gemfile.postgresql +0 -10
  71. data/gemfiles/rails-3.2/Gemfile.sqlite3 +0 -10
  72. data/gemfiles/rails-4.0/Gemfile.base +0 -3
  73. data/gemfiles/rails-4.0/Gemfile.mysql2 +0 -10
  74. data/gemfiles/rails-4.0/Gemfile.postgresql +0 -10
  75. data/gemfiles/rails-4.0/Gemfile.sqlite3 +0 -10
  76. data/gemfiles/rails-4.1/Gemfile.base +0 -3
  77. data/gemfiles/rails-4.1/Gemfile.mysql2 +0 -10
  78. data/gemfiles/rails-4.1/Gemfile.postgresql +0 -10
  79. data/gemfiles/rails-4.1/Gemfile.sqlite3 +0 -10
  80. data/lib/schema_plus/active_record/column_options_handler.rb +0 -117
  81. data/lib/schema_plus/active_record/connection_adapters/index_definition.rb +0 -70
  82. data/lib/schema_plus/active_record/db_default.rb +0 -19
  83. data/lib/schema_plus/active_record/foreign_keys.rb +0 -137
  84. data/lib/schema_plus/active_record/schema_dumper.rb +0 -171
  85. data/lib/schema_plus/railtie.rb +0 -20
  86. data/spec/index_definition_spec.rb +0 -211
  87. data/spec/index_spec.rb +0 -249
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 58bc995f73389eafe9656f43ae965eab34002187
4
- data.tar.gz: fd1b1b12ff5357065ab3b7a256fac090e86cae75
3
+ metadata.gz: 090fdf5adb8715e2bb78a10c58b7f5f5d4e9b219
4
+ data.tar.gz: 8950e08cdd6cbf912cb8508e40ce4b2449f914a0
5
5
  SHA512:
6
- metadata.gz: 8705f479301f9506afc99e71eed8219d758461b19d301b07d22499d51af0dfda33eac4d324c99f8903802aaa61b99ccd6379ba98eaad19bbc6c737720dfb3675
7
- data.tar.gz: bb3ae470aa2a9527f6ad61f7572ad484ed1ea23e526fe67fd525d17c72c2172a284ae2d4aeb1588107f1bfc5f95dc4f7c7574171e0025b2a77421602212d9750
6
+ metadata.gz: fcd75a62438cf8a1feb618f37a2e7e99bdc30a6691bf0131908978af5e8410ae330f537692f97e64b1a3f10f9588faeafc6c16860213d1d9dafeb9ac1bef7395
7
+ data.tar.gz: 6088b9ddf4b227aa4fa021c3ebed7be1369c881efcc392a5942d692a82ca5ba8e5058d35387d1794afecbde9e4ed1b143caa435aab7f09cff5d47fb81ec502af
data/.gitignore CHANGED
@@ -24,8 +24,8 @@ tmp
24
24
 
25
25
  ## PROJECT::SPECIFIC
26
26
  .rvmrc
27
+ *.lock
27
28
  *.log
28
- spec/*/*/*.sqlite3
29
- Gemfile.lock
30
- gemfiles/*.lock
31
- gemfiles/**/*.lock
29
+ *.sqlite3
30
+ !gemfiles/**/*.sqlite3
31
+ Gemfile.local
@@ -6,19 +6,8 @@
6
6
  sudo: false
7
7
  rvm:
8
8
  - 1.9.3
9
- - 2.1.3
10
- - jruby
9
+ - 2.1.5
11
10
  gemfile:
12
- - gemfiles/rails-3.2/Gemfile.mysql
13
- - gemfiles/rails-3.2/Gemfile.mysql2
14
- - gemfiles/rails-3.2/Gemfile.postgresql
15
- - gemfiles/rails-3.2/Gemfile.sqlite3
16
- - gemfiles/rails-4.0/Gemfile.mysql2
17
- - gemfiles/rails-4.0/Gemfile.postgresql
18
- - gemfiles/rails-4.0/Gemfile.sqlite3
19
- - gemfiles/rails-4.1/Gemfile.mysql2
20
- - gemfiles/rails-4.1/Gemfile.postgresql
21
- - gemfiles/rails-4.1/Gemfile.sqlite3
22
11
  - gemfiles/rails-4.2/Gemfile.mysql2
23
12
  - gemfiles/rails-4.2/Gemfile.postgresql
24
13
  - gemfiles/rails-4.2/Gemfile.sqlite3
@@ -28,38 +17,3 @@ addons:
28
17
  before_script: bundle exec rake create_databases
29
18
  after_script: bundle exec rake drop_databases
30
19
  script: bundle exec rake travis
31
- matrix:
32
- exclude:
33
- - rvm: jruby
34
- gemfile: gemfiles/rails-3.2/Gemfile.postgresql
35
- env: POSTGRESQL_DB_USER=postgres MYSQL_DB_USER=travis
36
- - rvm: jruby
37
- gemfile: gemfiles/rails-3.2/Gemfile.sqlite3
38
- env: POSTGRESQL_DB_USER=postgres MYSQL_DB_USER=travis
39
- - rvm: jruby
40
- gemfile: gemfiles/rails-4.0/Gemfile.mysql2
41
- env: POSTGRESQL_DB_USER=postgres MYSQL_DB_USER=travis
42
- - rvm: jruby
43
- gemfile: gemfiles/rails-4.0/Gemfile.postgresql
44
- env: POSTGRESQL_DB_USER=postgres MYSQL_DB_USER=travis
45
- - rvm: jruby
46
- gemfile: gemfiles/rails-4.0/Gemfile.sqlite3
47
- env: POSTGRESQL_DB_USER=postgres MYSQL_DB_USER=travis
48
- - rvm: jruby
49
- gemfile: gemfiles/rails-4.1/Gemfile.mysql2
50
- env: POSTGRESQL_DB_USER=postgres MYSQL_DB_USER=travis
51
- - rvm: jruby
52
- gemfile: gemfiles/rails-4.1/Gemfile.postgresql
53
- env: POSTGRESQL_DB_USER=postgres MYSQL_DB_USER=travis
54
- - rvm: jruby
55
- gemfile: gemfiles/rails-4.1/Gemfile.sqlite3
56
- env: POSTGRESQL_DB_USER=postgres MYSQL_DB_USER=travis
57
- - rvm: jruby
58
- gemfile: gemfiles/rails-4.2/Gemfile.mysql2
59
- env: POSTGRESQL_DB_USER=postgres MYSQL_DB_USER=travis
60
- - rvm: jruby
61
- gemfile: gemfiles/rails-4.2/Gemfile.postgresql
62
- env: POSTGRESQL_DB_USER=postgres MYSQL_DB_USER=travis
63
- - rvm: jruby
64
- gemfile: gemfiles/rails-4.2/Gemfile.sqlite3
65
- env: POSTGRESQL_DB_USER=postgres MYSQL_DB_USER=travis
@@ -2,41 +2,6 @@
2
2
 
3
3
  ## Change Log
4
4
 
5
- ## 1.8.9
6
-
7
- * Bug fix: Disable auto_create when sqlite3 implicitly copies a table (#213)
8
-
9
- ## 1.8.8
10
-
11
- * Bug fix: Postgres index creation was ignoring option `algorithm: :concurrently` (#209)
12
-
13
- ## 1.8.7
14
-
15
- * Bug fix: Postgres schema dump failed when using case_sensitive => false and operator_class together (#204). Thanks to [@mikeauclair](https://github.com/mikeauclair)
16
-
17
- * Bug fix: With complex cyclic foreign key dependencies, schema dump would issue constraint before table definition (#203). Thanks to [@konjoot](https://github.com/konjoot)
18
-
19
-
20
- ## 1.8.6
21
-
22
- * Bug fix: Don't drop column `array: true` for ActiveRecord 4.2. (#199)
23
-
24
- ## 1.8.5
25
-
26
- * Bug fix: DB_DEFAULT shouldn't cause t.inet columns to fail. (#198)
27
-
28
- ## 1.8.4
29
-
30
- * Bug fix: Allow default value as hash for json columns (#195)
31
-
32
- ## 1.8.3
33
-
34
- * Don't modifiy migration column options hashes (#191). Thanks to [@lowjoel](https://github.com/lowjoel)
35
-
36
- ## 1.8.2
37
-
38
- * Bug fix when using t.references in change_table (#194). Thanks to [@boone](https://github.com/boone)
39
-
40
5
  ## 1.8.1
41
6
 
42
7
  * Bug fix for AR 4.2, spurious add_foreign_key statements at the top of schema dump. Thanks to [@tovodeverett](https://github.com/tovodeverett) for doing better testing than me!
data/README.md CHANGED
@@ -1,135 +1,123 @@
1
- > ## This is the README for schema_plus 1.8.x
2
- > which supports Rails 3.2, 4.0, 4.1, and 4.2.0. Ongoing development towards schema_plus 2.0 takes place in the [master branch](https://github.com/SchemaPlus/schema_plus/tree/master), supporting only Rails >= 4.2
3
1
 
4
- ---
5
-
6
- # SchemaPlus
7
-
8
-
9
- SchemaPlus is an ActiveRecord extension that provides enhanced capabilities
10
- for schema definition and querying, including: enhanced and more DRY index
11
- capabilities, support and automation for foreign key constraints, and support
12
- for views.
2
+ > ## This is the README for SchemaPlus 2.0.0 (prelease)
3
+ > which is under development in the master branch, and which supports Rails >= 4.2. For info about the stable 1.x releases which support Rails 3.1, 4.0, 4.1, and 4.2, see the [schema_plus 1.x](https://github.com/SchemaPlus/schema_plus/tree/1.x) branch
13
4
 
14
- For added rails DRYness see also the gems
15
- [schema_associations](http://rubygems.org/gems/schema_associations) and
16
- [schema_validations](http://rubygems.org/gems/schema_validations)
5
+ ---
17
6
 
18
7
  [![Gem Version](https://badge.fury.io/rb/schema_plus.svg)](http://badge.fury.io/rb/schema_plus)
19
8
  [![Build Status](https://secure.travis-ci.org/SchemaPlus/schema_plus.svg)](http://travis-ci.org/SchemaPlus/schema_plus)
20
9
  [![Coverage Status](https://img.shields.io/coveralls/SchemaPlus/schema_plus.svg)](https://coveralls.io/r/SchemaPlus/schema_plus)
21
10
  [![Dependency Status](https://gemnasium.com/lomba/schema_plus.svg)](https://gemnasium.com/SchemaPlus/schema_plus)
22
11
 
23
- ## Compatibility
12
+ # SchemaPlus 2.x
24
13
 
25
- SchemaPlus supports all combinations of:
14
+ Starting with version 2.0.0, schema_plus is a wrapper that pulls in a collection of individual feature gems:
26
15
 
27
- * Rails/ActiveRecord 3.2, 4.0, 4.1, and 4.2.0
28
- * PostgreSQL, MySQL (using mysql2 gem; mysql gem only supported with Rails
29
- 3.2), or SQLite3 (using sqlite3 >= 3.7.7 for foreign key support, >= 3.8 for partial indexes)
30
- * MRI Ruby >= 1.9.3
16
+ * [schema_plus_indexes](https://github.com/SchemaPlus/schema_plus_indexes) -- Convenience and consistency in defining and manipulting indexes
17
+ * [schema_plus_pg_indexes](https://github.com/SchemaPlus/schema_plus_pg_indexes) -- Support for PostgreSQL index features: `case_insenstive`, `expression` and `operator_class`
31
18
 
32
- And also supports:
19
+ See detailed documentation in each feature gem's README. You can of course just use whichever of those gems you want individually, rather than this wrapper.
33
20
 
34
- * jruby with Rails/ActiveRecord 3.2 and PostgreSQL or MySQL
21
+ > **IN PROGRESS:** In the prerelease versions of SchemaPlus 2.0, more feature gems have yet to be stripped out, and the code is still in the body of schema_plus. Anticipated features gems include:
22
+ >
23
+ > * schema_plus_columns -- Extra Column features, including `column.indexes` and `column.unique?`
24
+ > * schema_plus_db_default -- Supports `update_attributes!(my_attr: ActiveRecord::DB_DEFAULT)` to set a column back to the default in the database schema.
25
+ > * schema_plus_default_expr -- Supports using SQL expressions for database default values
26
+ > * schema_plus_enums -- Support for enum types
27
+ > * schema_plus_foreign_keys -- Extends support for foreign keys, including automatic creation.
28
+ > * schema_plus_tables -- Convenience and consistency in defining and manipulating tables
29
+ > * schema_plus_views -- Adds support for creating and manipulating views
30
+ >
31
+ > The documentation for these features is at the end of this README
35
32
 
36
33
 
37
- ## Installation
34
+ ## Upgrading from SchemaPlus 1.8.x
38
35
 
39
- Install from http://rubygems.org via
36
+ SchemaPlus 2.0.x intends to be a completely backwards-compatible drop-in replacement for SchemaPlus 1.8.x, for projects using rails 4.2.
40
37
 
41
- $ gem install "schema_plus"
38
+ If you find any incompatibilities, please report an issue!
42
39
 
43
- or in a Gemfile
40
+ ### Deprecations
41
+ In cases where rails 4.2 has introduced features previously supported only by SchemaPlus, but using different names, SchemaPlus 2.0 now issues deprecation warnings in favor of the rails form. The complete list of deprecations:
44
42
 
45
- gem "schema_plus"
43
+ * Index definitions deprecate these options:
44
+ * `:conditions` => `:where`
45
+ * `:kind` => `:using`
46
46
 
47
- ## Features
47
+ * Foreign key definitions deprecate options to `:on_update` and `:on_delete`:
48
+ * `:set_null` => `:nullify`
48
49
 
49
- This README lists the major features, with examples of use. For full details see the
50
- [RDoc documentation](http://rubydoc.info/gems/schema_plus).
50
+ * `add_foreign_key` and `remove_foreign_key` deprecate the method signature:
51
+ * `(from_table, columns, to_table, primary_keys, options)` => `(from_table, to_table, options)`
51
52
 
52
- ### Indexes
53
+ * `ForeignKeyDefinition` deprecates accessors:
54
+ * `#table_name` in favor of `#from_table`
55
+ * `#column_names` in favor of `#column`
56
+ * `#references_column_names` in favor of `#primary_key`
57
+ * `#references_table_name in favor of `#to_table`
53
58
 
54
- With standard Rails 3 migrations, you specify indexes separately from the
55
- table definition:
59
+ * `IndexDefinition` deprecates accessors:
60
+ * `#conditions` in favor of `#where`
61
+ * `#kind` in favor of `#using`
56
62
 
57
- # Standard Rails approach...
58
- create_table :parts do |t|
59
- t.string :name
60
- t.string :product_code
61
- end
63
+ ## Compatibility
62
64
 
63
- add_index :parts, :name # index repeats table and column names and is defined separately
64
- add_index :parts, :product_code, unique: true
65
+ SchemaPlus 2.x is tested against all combinations of:
65
66
 
66
- But with SchemaPlus you can specify your indexes when you define each column,
67
- 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.)
67
+ <!-- SCHEMA_DEV: MATRIX - begin -->
68
+ <!-- These lines are auto-generated by schema_dev based on schema_dev.yml -->
69
+ * ruby **1.9.3** with rails **4.2**, using **mysql2**, **sqlite3** or **postgresql**
70
+ * ruby **2.1.5** with rails **4.2**, using **mysql2**, **sqlite3** or **postgresql**
68
71
 
69
- # More DRY way...
70
- create_table :parts do |t|
71
- t.string :name, index: true
72
- t.string :product_code, index: { unique: true }
73
- end
72
+ <!-- SCHEMA_DEV: MATRIX - end -->
74
73
 
75
- The options hash can include an index name:
74
+ ## Installation
76
75
 
77
- t.string :product_code, index: { unique: true, name: "my_index_name" }
76
+ Install from http://rubygems.org via
78
77
 
79
- You can also create multi-column indexes, for example:
78
+ $ gem install "schema_plus"
80
79
 
81
- t.string :first_name
82
- t.string :last_name, index: { with: :first_name }
80
+ or in a Gemfile
83
81
 
84
- t.string :country_code
85
- t.string :area_code
86
- t.string :local_number, index: { with: [:country_code, :area_code], unique: true }
82
+ gem "schema_plus"
83
+
84
+ ## History
87
85
 
88
- And you can specify index orders:
86
+ * See [CHANGELOG](CHANGELOG.md) for per-version release notes.
89
87
 
90
- t.string :first_name
91
- t.string :last_name, index: { with: :first_name, order: { first_name: :desc, last_name: :asc}}
88
+ * SchemaPlus is derived from several "Red Hill On Rails" plugins originally
89
+ created by [@harukizaemon](https://github.com/harukizaemon)
92
90
 
93
- As a convenient shorthand, the :unique option can be specified as
91
+ * SchemaPlus was created in 2011 by [@mlomnicki](https://github.com/mlomnicki) and [@ronen](https://github.com/ronen)
94
92
 
95
- t.string :product_code, index: :unique
93
+ * And [lots of contributors](https://github.com/SchemaPlus/schema_plus/graphs/contributors) since then
96
94
 
97
- which is equivalent to
95
+ ## Development & Testing
98
96
 
99
- t.string :product_code, index: { unique: true }
97
+ Are you interested in contributing to schema_plus? Thanks!
100
98
 
101
- If you're using PostgreSQL, SchemaPlus provides support for conditions,
102
- expressions, index methods, operator classes, and case-insensitive indexes:
99
+ Schema_plus has a full set of rspec tests. [travis-ci](http://travis-ci.org/SchemaPlus/schema_plus) runs the tests on the full matrix of supported versions of ruby, rails, and db adapters. But you can also test all or some part of the matrix locally before you push your changes, using
103
100
 
104
- t.string :last_name, index: { conditions: 'deleted_at IS NULL' }
105
- t.string :last_name, index: { expression: 'upper(last_name)' }
106
- t.string :last_name, index: { kind: 'hash' }
107
- t.string :last_name, index: { operator_class: 'varchar_pattern_ops' }
108
- t.string :last_name, index: { with: :address, operator_class: {last_name: 'varchar_pattern_ops', address: 'text_pattern_ops' }
109
- t.string :last_name, index: { case_sensitive: false } # shorthand for expression: 'lower(last_name)'
101
+ $ schema_dev rspec
110
102
 
111
103
 
112
- These features are available also in `ActiveRecord::Migration.add_index`. See
113
- doc for [SchemaPlus::ActiveRecord::ConnectionAdapters::PostgresqlAdapter](http://rubydoc.info/gems/schema_plus/SchemaPlus/ActiveRecord/ConnectionAdapters/PostgresqlAdapter) and
114
- [SchemaPlus::ActiveRecord::ConnectionAdapters::IndexDefinition](http://rubydoc.info/gems/schema_plus/SchemaPlus/ActiveRecord/ConnectionAdapters/IndexDefinition)
104
+ For more details, see the [schema_dev](https://github.com/SchemaPlus/schema_dev) README.
115
105
 
116
- When you query column information using ActiveRecord::Base#columns, SchemaPlus
117
- analogously provides index information relevant to each column: which indexes
118
- reference the column, whether the column must be unique, etc. See doc for
119
- [SchemaPlus::ActiveRecord::ConnectionAdapters::Column](http://rubydoc.info/gems/schema_plus/SchemaPlus/ActiveRecord/ConnectionAdapters/Column).
106
+ ---
107
+ ---
120
108
 
121
- SchemaPlus also tidies some index-related behavior:
109
+ # Prerelease: Documentation of features still be moved into separate feature gems
122
110
 
123
- * Rails' various db adapters have inconsistent behavior regarding an attempt
124
- to create a duplicate index: some quietly ignore the attempt, some raise
125
- an error. SchemaPlus regularizes the behavor to ignore the attempt for
126
- all db adapters.
111
+
112
+ > **NOTE** The documentation in this README is leftover from the 1.x branch; the functionality is the same, but some of the core features of schema_plus (such as foreign keys & inline index definition) are now provided by ActiveRecord 4.2. schema_plus still provides extra functionality beyond AR 4.2, but the documentation needs to be updated to be clear what's an enhancement of AR 4.2 capabilities rather than completely new features.
127
113
 
128
- * If you rename a table, indexes named using rails' automatic naming
129
- convention will be renamed correspondingly.
114
+ ### Columns
130
115
 
131
- * `remove_index` now accepts an `:if_exists` option to prevent errors from attempting to remove non-existent indexes.
132
116
 
117
+ When you query column information using ActiveRecord::Base#columns, SchemaPlus
118
+ analogously provides index information relevant to each column: which indexes
119
+ reference the column, whether the column must be unique, etc. See doc for
120
+ [SchemaPlus::ActiveRecord::ConnectionAdapters::Column](http://rubydoc.info/gems/schema_plus/SchemaPlus/ActiveRecord/ConnectionAdapters/Column).
133
121
 
134
122
  ### Foreign Key Constraints
135
123
 
@@ -329,25 +317,3 @@ of foreign key constraints, you can re-enable it:
329
317
  end
330
318
 
331
319
 
332
- ## History
333
-
334
- * See [CHANGELOG](CHANGELOG.md) for per-version release notes.
335
-
336
- * SchemaPlus is derived from several "Red Hill On Rails" plugins originally
337
- created by [@harukizaemon](https://github.com/harukizaemon)
338
-
339
- * SchemaPlus was created in 2011 by [@mlomnicki](https://github.com/mlomnicki) and [@ronen](https://github.com/ronen)
340
-
341
- * And [lots of contributors](https://github.com/SchemaPlus/schema_plus/graphs/contributors) since then
342
-
343
- ## Development & Testing
344
-
345
- Are you interested in contributing to schema_plus? Thanks!
346
-
347
- Schema_plus has a full set of rspec tests. [travis-ci](http://travis-ci.org/SchemaPlus/schema_plus) runs the tests on the full matrix of supported versions of ruby, rails, and db adapters. But you can also test all or some part of the matrix locally before you push your changes, using
348
-
349
- $ schema_dev rspec
350
-
351
-
352
- For more details, see the [schema_dev](https://github.com/SchemaPlus/schema_dev) README.
353
-
data/Rakefile CHANGED
@@ -5,17 +5,14 @@ require 'schema_dev/tasks'
5
5
 
6
6
  task :default => :spec
7
7
 
8
- # work around a bug in rake 10.0.3 with ruby 1.9.2
9
- unless RUBY_VERSION == "1.9.2"
10
- require 'rdoc/task'
11
- Rake::RDocTask.new do |rdoc|
12
- require File.dirname(__FILE__) + '/lib/schema_plus/version'
8
+ require 'rdoc/task'
9
+ Rake::RDocTask.new do |rdoc|
10
+ require File.dirname(__FILE__) + '/lib/schema_plus/version'
13
11
 
14
- rdoc.rdoc_dir = 'rdoc'
15
- rdoc.title = "schema_plus #{SchemaPlus::VERSION}"
16
- rdoc.rdoc_files.include('README*')
17
- rdoc.rdoc_files.include('lib/**/*.rb')
18
- end
12
+ rdoc.rdoc_dir = 'rdoc'
13
+ rdoc.title = "schema_plus #{SchemaPlus::VERSION}"
14
+ rdoc.rdoc_files.include('README*')
15
+ rdoc.rdoc_files.include('lib/**/*.rb')
19
16
  end
20
17
 
21
18
  require 'rspec/core/rake_task'
data/TODO.md ADDED
@@ -0,0 +1,51 @@
1
+ ## ALL
2
+
3
+ * ideally get rid of all uses of alias_method_chain outside schema_monkey (create middleware)
4
+ * rename everything to schema_plus_* (except schema_monkey and schema_plus)
5
+
6
+ ## schema_plus_tables
7
+
8
+ * depcrecate cascade: true in favor of force: cascade
9
+ * use middleware
10
+ * move specs over
11
+
12
+ ## schema_plus_index
13
+ * remove index specs that are testing things now handled by AR. (then see if coverage is still 100%)
14
+
15
+ ## schema_plus
16
+ * deprecate config => SchemaForeignKeys config
17
+ * move fk stuff into schema_foreign_keys
18
+ * add specs to cover the deprecations
19
+ * just do fk enhancements rather than replace AR's add_foreign_key and remove_foreign_key methods and foreign key lookups
20
+
21
+ ## schema_monkey
22
+ * consider automating the autoloads
23
+ * make middleware for remove_index
24
+ * make middleware for remove_column
25
+ * make middleware for rename_table
26
+ * make middleware for create_table
27
+ * make middleware for visit_TableDefinition
28
+ * make middleware for loading a schema
29
+ * make middleware for defining a table
30
+ * make ExecCache middleware work for all three adapters.
31
+ * @dump should include the header for consistency
32
+ * specs for schema_monkey
33
+ * README to document it -- the conventions and internal API
34
+ * (try it on AR 4.1? nah)
35
+
36
+ ## general
37
+ * rename schema_pg_enum to just schema_enum?
38
+ * pull apart READMEs
39
+ * test each gem separately to make sure they don't accidentally depend on each other
40
+
41
+ ## schema_dev things:
42
+
43
+ * boilerplate in README regarding the schema_plus family?
44
+ * boilerplate in README regarding test matrix?
45
+ * default 'rspec'
46
+ * don't bother changing ruby if it's the current version anyway.
47
+ * rename 'refresh' to 'freshen'; get rid of the individual travis & gem commands
48
+ * have a .schema_dev file with current settings
49
+ * make it obvious and easy to override
50
+ * auto update .gitignore to ignore it?
51
+ * log files should go in log/ not in tmp/ (auto update .gitignore to ignore it?)
@@ -4,3 +4,5 @@ gemspec :path => File.expand_path('..', __FILE__)
4
4
  platform :ruby do
5
5
  gem "byebug" if RUBY_VERSION > "2"
6
6
  end
7
+
8
+ File.exist?(gemfile_local = File.expand_path('../Gemfile.local', __FILE__)) and eval File.read(gemfile_local), binding, gemfile_local
@@ -0,0 +1,7 @@
1
+ require 'schema_monkey'
2
+ require 'schema_plus_indexes'
3
+
4
+ require_relative 'schema_column_plus/active_record/connection_adapters/column'
5
+ require_relative 'schema_column_plus/middleware/model'
6
+
7
+ SchemaMonkey.register(SchemaColumnPlus)