declare_schema 1.5.0.pre.1 → 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 +4 -4
- data/CHANGELOG.md +3 -1
- data/Gemfile.lock +2 -2
- data/declare_schema.gemspec +1 -1
- data/lib/declare_schema/version.rb +1 -1
- data/lib/generators/declare_schema/migration/migration_generator.rb +2 -6
- data/spec/lib/declare_schema/api_spec.rb +0 -4
- data/spec/lib/declare_schema/generator_spec.rb +27 -67
- data/spec/lib/declare_schema/migration_generator_spec.rb +1 -6
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92f1ec3624f575f6cbf8fb884b726c2957661f3d77078a467ca78e42dd95bdb2
|
4
|
+
data.tar.gz: 8735c888f46d675e49d06e56a37629e9cdf633218ce956ab111defc00013971f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c874389f98b8b7e6a5128a97324ad3a00597dc0892673f6d13c7b95611bb286d64afc40bee89cf992f71ba998a67fcd366ee2bd3527b71eb4113df8514ffe00d
|
7
|
+
data.tar.gz: 2a815e79364ae5eeb718488fa246adbf0730f0d9c4d92db802eedc2b9795c95a4061ca1d2a07014104a83f50a1dd6befb65ae49990e09f42e05a7b7e64fc0849
|
data/CHANGELOG.md
CHANGED
@@ -4,10 +4,12 @@ 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
|
-
## [
|
7
|
+
## [2.0.0] - 2024-05-14
|
8
8
|
### Added
|
9
9
|
- Added support for Rails 7.0 and 7.1
|
10
10
|
- Add support for automatic enum scopes for each value in the `:limit` array
|
11
|
+
### Removed
|
12
|
+
- Removed support for Rails < 6.0
|
11
13
|
|
12
14
|
## [1.4.0] - 2024-01-24
|
13
15
|
### Added
|
data/Gemfile.lock
CHANGED
data/declare_schema.gemspec
CHANGED
@@ -113,10 +113,8 @@ module DeclareSchema
|
|
113
113
|
ActiveRecord::Base.connection.schema_migration,
|
114
114
|
ActiveRecord::Base.connection.internal_metadata
|
115
115
|
).migrations
|
116
|
-
|
116
|
+
else
|
117
117
|
ActiveRecord::MigrationContext.new(ActiveRecord::Migrator.migrations_paths, ActiveRecord::SchemaMigration).migrations
|
118
|
-
else # Rails 5.2 and earlier
|
119
|
-
ActiveRecord::MigrationContext.new(ActiveRecord::Migrator.migrations_paths).migrations
|
120
118
|
end
|
121
119
|
end
|
122
120
|
|
@@ -129,10 +127,8 @@ module DeclareSchema
|
|
129
127
|
ActiveRecord::Base.connection.schema_migration,
|
130
128
|
ActiveRecord::Base.connection.internal_metadata
|
131
129
|
).pending_migrations
|
132
|
-
|
130
|
+
else
|
133
131
|
ActiveRecord::Migrator.new(:up, migrations, ActiveRecord::SchemaMigration).pending_migrations
|
134
|
-
else # Rails 5.2 and earlier
|
135
|
-
ActiveRecord::Migrator.new(:up, migrations).pending_migrations
|
136
132
|
end
|
137
133
|
end
|
138
134
|
|
@@ -19,77 +19,37 @@ RSpec.describe 'DeclareSchema Migration Generator' do
|
|
19
19
|
end
|
20
20
|
EOS
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
"alpha_"
|
27
|
-
end
|
22
|
+
expect_model_definition_to_eq('alpha', <<~EOS)
|
23
|
+
module Alpha
|
24
|
+
def self.table_name_prefix
|
25
|
+
#{ActiveSupport::VERSION::MAJOR >= 7 ? '"alpha_"' : "'alpha_'"}
|
28
26
|
end
|
29
|
-
|
30
|
-
|
31
|
-
expect_model_definition_to_eq('alpha', <<~EOS)
|
32
|
-
module Alpha
|
33
|
-
def self.table_name_prefix
|
34
|
-
'alpha_'
|
35
|
-
end
|
36
|
-
end
|
37
|
-
EOS
|
38
|
-
end
|
27
|
+
end
|
28
|
+
EOS
|
39
29
|
|
40
|
-
|
41
|
-
|
42
|
-
expect_test_definition_to_eq('alpha/beta', <<~EOS)
|
43
|
-
require "test_helper"
|
30
|
+
expect_test_definition_to_eq('alpha/beta', <<~EOS)
|
31
|
+
require "test_helper"
|
44
32
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
else
|
52
|
-
expect_test_definition_to_eq('alpha/beta', <<~EOS)
|
53
|
-
require "test_helper"
|
54
|
-
|
55
|
-
class Alpha::BetaTest < ActiveSupport::TestCase
|
56
|
-
# test "the truth" do
|
57
|
-
# assert true
|
58
|
-
# end
|
59
|
-
end
|
60
|
-
EOS
|
61
|
-
end
|
33
|
+
class Alpha::BetaTest < ActiveSupport::TestCase
|
34
|
+
# test "the truth" do
|
35
|
+
# assert true
|
36
|
+
# end
|
37
|
+
end
|
38
|
+
EOS
|
62
39
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
# column: value
|
77
|
-
EOS
|
78
|
-
when 6
|
79
|
-
expect_test_fixture_to_eq('alpha/beta', <<~EOS)
|
80
|
-
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
81
|
-
|
82
|
-
# This model initially had no columns defined. If you add columns to the
|
83
|
-
# model remove the '{}' from the fixture names and add the columns immediately
|
84
|
-
# below each fixture, per the syntax in the comments below
|
85
|
-
#
|
86
|
-
one: {}
|
87
|
-
# column: value
|
88
|
-
#
|
89
|
-
two: {}
|
90
|
-
# column: value
|
91
|
-
EOS
|
92
|
-
end
|
40
|
+
expect_test_fixture_to_eq('alpha/beta', <<~EOS)
|
41
|
+
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
42
|
+
|
43
|
+
# This model initially had no columns defined. If you add columns to the
|
44
|
+
# model remove the #{ActiveSupport::VERSION::MAJOR >= 7 ? '"{}"' : "'{}'"} from the fixture names and add the columns immediately
|
45
|
+
# below each fixture, per the syntax in the comments below
|
46
|
+
#
|
47
|
+
one: {}
|
48
|
+
# column: value
|
49
|
+
#
|
50
|
+
two: {}
|
51
|
+
# column: value
|
52
|
+
EOS
|
93
53
|
|
94
54
|
$LOAD_PATH << "#{TESTAPP_PATH}/app/models"
|
95
55
|
|
@@ -38,12 +38,7 @@ RSpec.describe 'DeclareSchema Migration Generator' do
|
|
38
38
|
end
|
39
39
|
let(:table_options) do
|
40
40
|
if defined?(Mysql2)
|
41
|
-
|
42
|
-
if ActiveSupport::VERSION::MAJOR >= 6
|
43
|
-
', charset: "utf8mb4", collation: "utf8mb4_bin"'
|
44
|
-
else
|
45
|
-
''
|
46
|
-
end
|
41
|
+
', options: "DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin", charset: "utf8mb4", collation: "utf8mb4_bin"'
|
47
42
|
else
|
48
43
|
", id: :integer"
|
49
44
|
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:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Invoca Development adapted from hobo_fields by Tom Locke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-05-
|
11
|
+
date: 2024-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '6.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '6.0'
|
27
27
|
description: Declare your Rails/active_record model schemas and have database migrations
|
28
28
|
generated for you!
|
29
29
|
email: development@invoca.com
|