declare_schema 1.2.1 → 1.2.2.pre.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9ba6099c2cfd605309415e3a14d53ba36aecad45285c4babdc385fa3576225ff
4
- data.tar.gz: 60c009064977df314115e0bd1db8e811ba05866e24ac652a31b3ec4bc25291f5
3
+ metadata.gz: 845f78b84a0a36a5d218c35351b1445d669b512b96745ee7bf7ab6a2a0a97277
4
+ data.tar.gz: d983c4fb5d5e3bb123854a8dada61c02970de010331770f77ab3630c084c8a04
5
5
  SHA512:
6
- metadata.gz: 9a7308b18a3a38c4713a2effb7f7f9dcf6b75702703152292061d4e266ada35b7be47e4ab43322965f9bfb0c88886ee138bea984bf0e09a9d37dde8bd1fe2da5
7
- data.tar.gz: 10c67731046059b1ae1ff483ae979f4b649805deac4559ae2e4533082fa4e4a66e237814ff5873c638543ed533a5f660bf1dd204a5e3a8356fe377da1769d388
6
+ metadata.gz: 4bcf9de4ccb29f0679ebe15f3892858e628bda5ed4eb30b7d7860d687a2233df7b24d7a913772b8b4d312ab378bcdc4b2fa1675b17f9d69e20d166d1eb0f0dba
7
+ data.tar.gz: 8e21e6bc2a9d5dd6f3ab40b971cf6f31de66901049f28b17f927d40ae247ecd6c7af60bfe300f9f27b15af0e58df205a3de7e9f97a5dc4a94c8c5bf7b5602a8c
@@ -16,11 +16,6 @@ jobs:
16
16
  - gemfiles/rails_5_sqlite.gemfile
17
17
  - gemfiles/rails_6_mysql.gemfile
18
18
  - gemfiles/rails_6_sqlite.gemfile
19
- include:
20
- - gemfile: gemfiles/rails_5_mysql.gemfile
21
- ruby: 2.5
22
- - gemfile: gemfiles/rails_5_sqlite.gemfile
23
- ruby: 2.5
24
19
  exclude:
25
20
  - ruby: '3.0'
26
21
  gemfile: gemfiles/rails_5_mysql.gemfile
data/CHANGELOG.md CHANGED
@@ -4,6 +4,17 @@ Inspired by [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
4
4
 
5
5
  Note: this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [1.2.2] - Unreleased
8
+ ### Changed
9
+ - Documented `belongs_to` and `has_and_belongs_to_many` behavior
10
+ - Documented configurable ignored tables behavior
11
+
12
+ ### Fixed
13
+ - Ruby 3.x kwargs issue when calling `validates`
14
+
15
+ ### Removed
16
+ - Ruby 2.5 from test matrix
17
+
7
18
  ## [1.2.1] - 2022-09-25
8
19
  ### Fixed
9
20
  - If Rails is defined, raise if `Rails.application` is `nil`.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- declare_schema (1.2.1)
4
+ declare_schema (1.2.2.pre.0)
5
5
  rails (>= 5.0)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -224,6 +224,40 @@ If your repo has a different command to run for migrations, you can configure it
224
224
  `DeclareSchema.db_migrate_command = "bundle exec rails db:migrate_immediate"`
225
225
  ```
226
226
 
227
+ ## The `belongs_to` Association
228
+ The foreign key for a `belongs_to` association refers to the primary key of the associated model. The `belongs_to`
229
+ association is outside of the `declare_schema do` block, so `declare_schema` intercepts the `belongs_to` macro to
230
+ infer the foreign key column.
231
+
232
+ By default, `declare_schema` creates an index for `belongs_to` relations. If this default index is not desired,
233
+ you can use `index: false` in the `belongs_to` expression. This may be the case if for example a different index
234
+ already accounts for it.
235
+
236
+ ## The `has_and_belongs_to_many` Association
237
+ Like the `belongs_to` association, `has_and_belongs_to_many` is outside of the `declare_schema ` block. `declare_schema` similarly
238
+ infers foreign keys (and the intersection table).
239
+
240
+ ## Ignored Tables
241
+ If a table's schema or metadata are managed elsewhere, `declare_schema` probably should not alter it. Accordingly,
242
+ `declare_schema` can be configured to ignore tables.
243
+
244
+ `declare_schema` by default ignores these tables:
245
+ - The ActiveRecord `schema_info` table
246
+ - The ActiveRecord schema migrations table (generally named `schema_migrations`)
247
+ - The ActiveRecord internal metadata table (generally named `ar_internal_metadata`)
248
+ - If defined/configured, the CGI ActiveRecordStore session table
249
+
250
+ Additional tables can be ignored by configuring `Generators::DeclareSchema::Migration::Migrator.ignore_tables`.
251
+ For example:
252
+
253
+ ```ruby
254
+ ::Generators::DeclareSchema::Migration::Migrator.ignore_tables = [
255
+ "delayed_jobs",
256
+ "my_snowflake_table",
257
+ ...
258
+ ]
259
+ ```
260
+
227
261
  ## Declaring Character Set and Collation
228
262
  _Note: This feature currently only works for MySQL database configurations._
229
263
 
@@ -227,7 +227,7 @@ module DeclareSchema
227
227
  validates_uniqueness_of name, allow_nil: !:required.in?(args) if :unique.in?(args)
228
228
 
229
229
  if (validates_options = options[:validates])
230
- validates name, validates_options
230
+ validates(name, **validates_options)
231
231
  end
232
232
 
233
233
  # Support for custom validations
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DeclareSchema
4
- VERSION = "1.2.1"
4
+ VERSION = "1.2.2.pre.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: declare_schema
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2.pre.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Invoca Development adapted from hobo_fields by Tom Locke
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-25 00:00:00.000000000 Z
11
+ date: 2023-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -127,7 +127,7 @@ homepage: https://github.com/Invoca/declare_schema
127
127
  licenses: []
128
128
  metadata:
129
129
  allowed_push_host: https://rubygems.org
130
- post_install_message:
130
+ post_install_message:
131
131
  rdoc_options: []
132
132
  require_paths:
133
133
  - lib
@@ -143,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
143
  version: 1.3.6
144
144
  requirements: []
145
145
  rubygems_version: 3.1.6
146
- signing_key:
146
+ signing_key:
147
147
  specification_version: 4
148
148
  summary: Database schema declaration and migration generator for Rails
149
149
  test_files: []