declare_schema 0.13.1 → 0.13.2

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: 4caf19f1ddb0978b9e9bbc5c55d5941a934ded2e4bbd8adfba52c078e599106b
4
- data.tar.gz: 2a8d9f9434f6acae5cab5bfe4ffc6eee0d6ce0e31a59b471d0c48b63b0c3260c
3
+ metadata.gz: e3a8974d1b6642065c32bf892d5b8eb2a7da63064bcc74a5b6f4982a21ac1771
4
+ data.tar.gz: d1cd0489a73e399b4ed21ec3e83c761d5edf821bcc1435d4f42e171700ccc27c
5
5
  SHA512:
6
- metadata.gz: 6edfafddcd596afd63417d2e8f59aec7bfcd637e35d0fb77fc06f39e6e78d461da5c2e0b6752cb8b18785afa0ac81cfb7569fa0be85ba06ad3432d3911a624e5
7
- data.tar.gz: 7d2d190f0c6928f7b70f96c8ce58517475ce1b512a31a7c33033314bff0405fb51d88c82c72bd0a8a1b25d8558039ef787b0314b60f7fdefbd75975c3320f57e
6
+ metadata.gz: 8926952cc9aec61b28cc9fe74d5766d3c67f35734b9bec4d93a767e58966a48bccc8bd49b919f9699c9d0e386f0ae2b9d43ffa65fec764959e6389b3daf92496
7
+ data.tar.gz: 9149635173ede506625904d2ffa6aa4864c7dae69c0edf1dba776a60c5a46e77c95ccbb711d8db6c2aef63e4f38ae58e795686bbcce1574fc1ace064077eb593
data/CHANGELOG.md CHANGED
@@ -4,6 +4,10 @@ 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
+ ## [0.13.2] - 2021-08-04
8
+ ### Fixed
9
+ - Fixed issue with disable_auto_increment support for new tables.
10
+
7
11
  ## [0.13.1] - 2021-08-02
8
12
  ### Fixed
9
13
  - Fixed migration file indentation bug in Rails 5 where the first line was indented an extra 4 characters.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- declare_schema (0.13.1)
4
+ declare_schema (0.13.2)
5
5
  rails (>= 4.2)
6
6
 
7
7
  GEM
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DeclareSchema
4
- VERSION = "0.13.1"
4
+ VERSION = "0.13.2"
5
5
  end
@@ -226,7 +226,9 @@ module Generators
226
226
 
227
227
  primary_key_definition =
228
228
  if disable_auto_increment
229
- [:integer, :id, limit: 8, auto_increment: false, primary_key: true]
229
+ [[:integer, :id, limit: 8, auto_increment: false, primary_key: true]]
230
+ else
231
+ []
230
232
  end
231
233
 
232
234
  field_definitions = model.field_specs.values.sort_by(&:position).map do |f|
@@ -237,7 +239,7 @@ module Generators
237
239
  table_options = create_table_options(model, disable_auto_increment)
238
240
 
239
241
  table_add = ::DeclareSchema::SchemaChange::TableAdd.new(t,
240
- Array(primary_key_definition) + field_definitions,
242
+ primary_key_definition + field_definitions,
241
243
  table_options,
242
244
  sql_options: table_options_definition.settings)
243
245
  [
@@ -803,9 +803,34 @@ RSpec.describe 'DeclareSchema Migration Generator' do
803
803
  EOS
804
804
  )
805
805
 
806
+ Advert.connection.schema_cache.clear!
807
+ Advert.reset_column_information
808
+
806
809
  nuke_model_class(Advert)
807
810
  ActiveRecord::Base.connection.execute("drop table `adverts`;")
808
811
 
812
+ class Advert < ActiveRecord::Base
813
+ def self.disable_auto_increment
814
+ true
815
+ end
816
+
817
+ fields do
818
+ description :text, limit: 250, null: true
819
+ end
820
+ end
821
+
822
+ up, _ = Generators::DeclareSchema::Migration::Migrator.run.tap do |migrations|
823
+ expect(migrations).to(
824
+ migrate_up(<<~EOS.strip)
825
+ create_table :adverts, id: false do |t|
826
+ t.integer :id, limit: 8, auto_increment: false, primary_key: true
827
+ t.text :description, limit: nil, null: true
828
+ end
829
+ EOS
830
+ .and migrate_down("drop_table :adverts")
831
+ )
832
+ end
833
+
809
834
  ## DSL
810
835
 
811
836
  # The DSL allows lambdas and constants
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: 0.13.1
4
+ version: 0.13.2
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: 2021-08-02 00:00:00.000000000 Z
11
+ date: 2021-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -128,7 +128,7 @@ homepage: https://github.com/Invoca/declare_schema
128
128
  licenses: []
129
129
  metadata:
130
130
  allowed_push_host: https://rubygems.org
131
- post_install_message:
131
+ post_install_message:
132
132
  rdoc_options: []
133
133
  require_paths:
134
134
  - lib
@@ -144,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
144
  version: 1.3.6
145
145
  requirements: []
146
146
  rubygems_version: 3.0.3
147
- signing_key:
147
+ signing_key:
148
148
  specification_version: 4
149
149
  summary: Database schema declaration and migration generator for Rails
150
150
  test_files: []