rom-sql 1.3.5 → 2.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -7
- data/Gemfile +7 -5
- data/lib/rom/plugins/relation/sql/auto_restrictions.rb +11 -17
- data/lib/rom/sql.rb +3 -2
- data/lib/rom/sql/associations.rb +5 -0
- data/lib/rom/sql/associations/core.rb +20 -0
- data/lib/rom/sql/associations/many_to_many.rb +83 -0
- data/lib/rom/sql/associations/many_to_one.rb +55 -0
- data/lib/rom/sql/associations/one_to_many.rb +31 -0
- data/lib/rom/sql/{association → associations}/one_to_one.rb +3 -2
- data/lib/rom/sql/{association → associations}/one_to_one_through.rb +3 -2
- data/lib/rom/sql/associations/self_ref.rb +39 -0
- data/lib/rom/sql/attribute.rb +44 -54
- data/lib/rom/sql/errors.rb +2 -0
- data/lib/rom/sql/extensions/mysql.rb +1 -1
- data/lib/rom/sql/extensions/mysql/attributes_inferrer.rb +10 -0
- data/lib/rom/sql/extensions/postgres.rb +1 -1
- data/lib/rom/sql/extensions/postgres/{inferrer.rb → attributes_inferrer.rb} +4 -4
- data/lib/rom/sql/extensions/postgres/types.rb +9 -19
- data/lib/rom/sql/extensions/sqlite.rb +1 -1
- data/lib/rom/sql/extensions/sqlite/{inferrer.rb → attributes_inferrer.rb} +2 -2
- data/lib/rom/sql/gateway.rb +29 -30
- data/lib/rom/sql/index.rb +13 -0
- data/lib/rom/sql/migration.rb +10 -0
- data/lib/rom/sql/migration/inline_runner.rb +86 -0
- data/lib/rom/sql/migration/migrator.rb +17 -0
- data/lib/rom/sql/migration/schema_diff.rb +177 -0
- data/lib/rom/sql/plugin/associates.rb +11 -45
- data/lib/rom/sql/plugin/pagination.rb +4 -4
- data/lib/rom/sql/relation.rb +22 -42
- data/lib/rom/sql/relation/reading.rb +3 -3
- data/lib/rom/sql/schema.rb +14 -21
- data/lib/rom/sql/schema/associations_dsl.rb +7 -6
- data/lib/rom/sql/schema/attributes_inferrer.rb +164 -0
- data/lib/rom/sql/schema/inferrer.rb +40 -141
- data/lib/rom/sql/type_extensions.rb +44 -0
- data/lib/rom/sql/version.rb +1 -1
- data/lib/rom/sql/wrap.rb +25 -0
- data/rom-sql.gemspec +2 -2
- data/spec/integration/{association → associations}/many_to_many/custom_fks_spec.rb +4 -2
- data/spec/integration/{association → associations}/many_to_many/from_view_spec.rb +2 -2
- data/spec/integration/{association → associations}/many_to_many_spec.rb +25 -30
- data/spec/integration/{association → associations}/many_to_one/custom_fks_spec.rb +5 -3
- data/spec/integration/{association → associations}/many_to_one/from_view_spec.rb +3 -3
- data/spec/integration/{association → associations}/many_to_one/self_ref_spec.rb +2 -2
- data/spec/integration/{association → associations}/many_to_one_spec.rb +20 -38
- data/spec/integration/{association → associations}/one_to_many/custom_fks_spec.rb +4 -2
- data/spec/integration/{association → associations}/one_to_many/from_view_spec.rb +2 -2
- data/spec/integration/{association → associations}/one_to_many/self_ref_spec.rb +2 -2
- data/spec/integration/{association → associations}/one_to_many_spec.rb +24 -11
- data/spec/integration/{association → associations}/one_to_one_spec.rb +13 -9
- data/spec/integration/{association → associations}/one_to_one_through_spec.rb +15 -11
- data/spec/integration/auto_migrations/errors_spec.rb +31 -0
- data/spec/integration/auto_migrations/indexes_spec.rb +109 -0
- data/spec/integration/auto_migrations/managing_columns_spec.rb +156 -0
- data/spec/integration/auto_migrations/postgres/column_types_spec.rb +63 -0
- data/spec/integration/commands/create_spec.rb +2 -4
- data/spec/integration/commands/delete_spec.rb +2 -2
- data/spec/integration/commands/update_spec.rb +2 -0
- data/spec/integration/graph_spec.rb +9 -3
- data/spec/integration/plugins/associates_spec.rb +16 -55
- data/spec/integration/plugins/auto_restrictions_spec.rb +0 -11
- data/spec/integration/relation_schema_spec.rb +49 -25
- data/spec/integration/schema/inferrer/postgres_spec.rb +1 -1
- data/spec/integration/schema/inferrer_spec.rb +7 -18
- data/spec/integration/setup_spec.rb +4 -0
- data/spec/integration/{plugins/auto_wrap_spec.rb → wrap_spec.rb} +13 -36
- data/spec/shared/accounts.rb +4 -0
- data/spec/shared/database_setup.rb +2 -1
- data/spec/shared/notes.rb +2 -0
- data/spec/shared/posts.rb +2 -0
- data/spec/shared/puppies.rb +2 -0
- data/spec/shared/relations.rb +2 -2
- data/spec/shared/users.rb +2 -0
- data/spec/shared/users_and_tasks.rb +4 -0
- data/spec/spec_helper.rb +3 -6
- data/spec/support/helpers.rb +11 -8
- data/spec/support/test_configuration.rb +16 -0
- data/spec/unit/plugin/associates_spec.rb +5 -10
- data/spec/unit/plugin/pagination_spec.rb +9 -9
- data/spec/unit/plugin/timestamp_spec.rb +9 -9
- data/spec/unit/relation/dataset_spec.rb +7 -5
- data/spec/unit/relation/inner_join_spec.rb +2 -15
- data/spec/unit/relation/primary_key_spec.rb +1 -1
- data/spec/unit/schema_spec.rb +6 -4
- metadata +65 -70
- data/lib/rom/plugins/relation/sql/auto_combine.rb +0 -71
- data/lib/rom/plugins/relation/sql/auto_wrap.rb +0 -62
- data/lib/rom/sql/association.rb +0 -103
- data/lib/rom/sql/association/many_to_many.rb +0 -119
- data/lib/rom/sql/association/many_to_one.rb +0 -73
- data/lib/rom/sql/association/name.rb +0 -78
- data/lib/rom/sql/association/one_to_many.rb +0 -60
- data/lib/rom/sql/extensions/mysql/inferrer.rb +0 -10
- data/lib/rom/sql/qualified_attribute.rb +0 -53
- data/lib/rom/sql/schema/dsl.rb +0 -75
- data/spec/unit/association/many_to_many_spec.rb +0 -89
- data/spec/unit/association/many_to_one_spec.rb +0 -81
- data/spec/unit/association/name_spec.rb +0 -68
- data/spec/unit/association/one_to_many_spec.rb +0 -82
- data/spec/unit/association/one_to_one_spec.rb +0 -83
- data/spec/unit/association/one_to_one_through_spec.rb +0 -69
@@ -39,16 +39,5 @@ RSpec.describe 'Plugins / :auto_restrictions', seeds: true do
|
|
39
39
|
|
40
40
|
include_context 'auto-generated restriction view'
|
41
41
|
end
|
42
|
-
|
43
|
-
it 'raises error when enabled w/o a schema' do
|
44
|
-
expect {
|
45
|
-
conf.relation(:tasks) do
|
46
|
-
use :auto_restrictions
|
47
|
-
end
|
48
|
-
}.to raise_error(
|
49
|
-
ROM::Plugins::Relation::SQL::AutoRestrictions::EmptySchemaError,
|
50
|
-
"ROM::Relation[Tasks] relation has no schema. Make sure :auto_restrictions is enabled after defining a schema"
|
51
|
-
)
|
52
|
-
end
|
53
42
|
end
|
54
43
|
end
|
@@ -19,6 +19,30 @@ RSpec.describe 'Inferring schema from database' do
|
|
19
19
|
end
|
20
20
|
|
21
21
|
context 'defining associations', seeds: false do
|
22
|
+
let(:config) { TestConfiguration.new(:sql, conn) }
|
23
|
+
let(:container) { ROM.container(config) }
|
24
|
+
|
25
|
+
let(:user_associations) do
|
26
|
+
config.relation(:accounts) { schema(infer: true) }
|
27
|
+
config.relation(:cards) { schema(infer: true) }
|
28
|
+
config.register_relation(Test::Users)
|
29
|
+
container.relations[:users].associations
|
30
|
+
end
|
31
|
+
|
32
|
+
let(:post_associations) do
|
33
|
+
config.relation(:tags) { schema(infer: true) }
|
34
|
+
config.relation(:posts_tags) { schema(infer: true) }
|
35
|
+
config.register_relation(Test::Posts)
|
36
|
+
container.relations[:posts].associations
|
37
|
+
end
|
38
|
+
|
39
|
+
let(:tag_associations) do
|
40
|
+
config.relation(:posts) { schema(infer: true) }
|
41
|
+
config.relation(:posts_tags) { schema(infer: true) }
|
42
|
+
config.register_relation(Test::Tags)
|
43
|
+
container.relations[:tags].associations
|
44
|
+
end
|
45
|
+
|
22
46
|
it "allows defining a one-to-many" do
|
23
47
|
class Test::Posts < ROM::Relation[:sql]
|
24
48
|
schema(:posts) do
|
@@ -28,9 +52,9 @@ RSpec.describe 'Inferring schema from database' do
|
|
28
52
|
end
|
29
53
|
end
|
30
54
|
|
31
|
-
assoc = ROM::
|
55
|
+
assoc = ROM::Associations::Definitions::OneToMany.new(:posts, :tags)
|
32
56
|
|
33
|
-
expect(
|
57
|
+
expect(post_associations[:tags].definition).to eql(assoc)
|
34
58
|
end
|
35
59
|
|
36
60
|
it "allows defining a one-to-many using has_many shortcut" do
|
@@ -42,9 +66,9 @@ RSpec.describe 'Inferring schema from database' do
|
|
42
66
|
end
|
43
67
|
end
|
44
68
|
|
45
|
-
assoc = ROM::
|
69
|
+
assoc = ROM::Associations::Definitions::OneToMany.new(:posts, :tags)
|
46
70
|
|
47
|
-
expect(
|
71
|
+
expect(post_associations[:tags].definition).to eql(assoc)
|
48
72
|
end
|
49
73
|
|
50
74
|
it "allows defining a one-to-one" do
|
@@ -56,9 +80,9 @@ RSpec.describe 'Inferring schema from database' do
|
|
56
80
|
end
|
57
81
|
end
|
58
82
|
|
59
|
-
assoc = ROM::
|
83
|
+
assoc = ROM::Associations::Definitions::OneToOne.new(:users, :accounts)
|
60
84
|
|
61
|
-
expect(
|
85
|
+
expect(user_associations[:accounts].definition).to eql(assoc)
|
62
86
|
end
|
63
87
|
|
64
88
|
it "allows defining a one-to-one using has_one shortcut" do
|
@@ -70,10 +94,10 @@ RSpec.describe 'Inferring schema from database' do
|
|
70
94
|
end
|
71
95
|
end
|
72
96
|
|
73
|
-
assoc = ROM::
|
97
|
+
assoc = ROM::Associations::Definitions::OneToOne.new(:users, :accounts, as: :account)
|
74
98
|
|
75
|
-
expect(
|
76
|
-
expect(
|
99
|
+
expect(user_associations[:account].definition).to eql(assoc)
|
100
|
+
expect(user_associations[:account].definition.target).to be_aliased
|
77
101
|
end
|
78
102
|
|
79
103
|
it "allows defining a one-to-one using has_one shortcut with an alias" do
|
@@ -85,10 +109,10 @@ RSpec.describe 'Inferring schema from database' do
|
|
85
109
|
end
|
86
110
|
end
|
87
111
|
|
88
|
-
assoc = ROM::
|
112
|
+
assoc = ROM::Associations::Definitions::OneToOne.new(:users, :accounts, as: :user_account)
|
89
113
|
|
90
|
-
expect(
|
91
|
-
expect(
|
114
|
+
expect(user_associations[:user_account].definition).to eql(assoc)
|
115
|
+
expect(user_associations[:user_account].definition.target).to be_aliased
|
92
116
|
end
|
93
117
|
|
94
118
|
it "allows defining a one-to-one-through" do
|
@@ -100,9 +124,9 @@ RSpec.describe 'Inferring schema from database' do
|
|
100
124
|
end
|
101
125
|
end
|
102
126
|
|
103
|
-
assoc = ROM::
|
127
|
+
assoc = ROM::Associations::Definitions::OneToOneThrough.new(:users, :cards, through: :accounts)
|
104
128
|
|
105
|
-
expect(
|
129
|
+
expect(user_associations[:cards].definition).to eql(assoc)
|
106
130
|
end
|
107
131
|
|
108
132
|
it "allows defining a many-to-one" do
|
@@ -114,9 +138,9 @@ RSpec.describe 'Inferring schema from database' do
|
|
114
138
|
end
|
115
139
|
end
|
116
140
|
|
117
|
-
assoc = ROM::
|
141
|
+
assoc = ROM::Associations::Definitions::ManyToOne.new(:tags, :posts)
|
118
142
|
|
119
|
-
expect(
|
143
|
+
expect(tag_associations[:posts].definition).to eql(assoc)
|
120
144
|
end
|
121
145
|
|
122
146
|
it "allows defining a many-to-one using belongs_to shortcut" do
|
@@ -128,9 +152,9 @@ RSpec.describe 'Inferring schema from database' do
|
|
128
152
|
end
|
129
153
|
end
|
130
154
|
|
131
|
-
assoc = ROM::
|
155
|
+
assoc = ROM::Associations::Definitions::ManyToOne.new(:tags, :posts, as: :post)
|
132
156
|
|
133
|
-
expect(
|
157
|
+
expect(tag_associations[:post].definition).to eql(assoc)
|
134
158
|
end
|
135
159
|
|
136
160
|
it "allows defining a many-to-one using belongs_to shortcut" do
|
@@ -142,9 +166,9 @@ RSpec.describe 'Inferring schema from database' do
|
|
142
166
|
end
|
143
167
|
end
|
144
168
|
|
145
|
-
assoc = ROM::
|
169
|
+
assoc = ROM::Associations::Definitions::ManyToOne.new(:tags, :posts, as: :post_tag)
|
146
170
|
|
147
|
-
expect(
|
171
|
+
expect(tag_associations[:post_tag].definition).to eql(assoc)
|
148
172
|
end
|
149
173
|
|
150
174
|
it "allows defining a many-to-many" do
|
@@ -156,23 +180,23 @@ RSpec.describe 'Inferring schema from database' do
|
|
156
180
|
end
|
157
181
|
end
|
158
182
|
|
159
|
-
assoc = ROM::
|
183
|
+
assoc = ROM::Associations::Definitions::ManyToMany.new(:posts, :tags, through: :posts_tags)
|
160
184
|
|
161
|
-
expect(
|
185
|
+
expect(post_associations[:tags].definition).to eql(assoc)
|
162
186
|
end
|
163
187
|
|
164
188
|
it "allows defining a many-to-one with a custom name" do
|
165
189
|
class Test::Tags < ROM::Relation[:sql]
|
166
190
|
schema(:tags) do
|
167
191
|
associations do
|
168
|
-
many_to_one :
|
192
|
+
many_to_one :posts, as: :published_posts
|
169
193
|
end
|
170
194
|
end
|
171
195
|
end
|
172
196
|
|
173
|
-
assoc = ROM::
|
197
|
+
assoc = ROM::Associations::Definitions::ManyToOne.new(:tags, :posts, as: :published_posts)
|
174
198
|
|
175
|
-
expect(
|
199
|
+
expect(tag_associations[:published_posts].definition).to eql(assoc)
|
176
200
|
end
|
177
201
|
end
|
178
202
|
end
|
@@ -63,7 +63,7 @@ RSpec.describe 'ROM::SQL::Schema::PostgresInferrer', :postgres do
|
|
63
63
|
jsonb_data: ROM::SQL::Types::PG::JSONB.optional.meta(name: :jsonb_data, source: source),
|
64
64
|
money: ROM::SQL::Types::Decimal.meta(name: :money, source: source),
|
65
65
|
tags: ROM::SQL::Types::PG::Array('text').optional.meta(name: :tags, source: source),
|
66
|
-
tag_ids: ROM::SQL::Types::PG::Array('
|
66
|
+
tag_ids: ROM::SQL::Types::PG::Array('biging').optional.meta(name: :tag_ids, source: source),
|
67
67
|
color: ROM::SQL::Types::String.enum(*colors).optional.meta(name: :color, source: source),
|
68
68
|
ip: ROM::SQL::Types::PG::IPAddress.optional.meta(
|
69
69
|
name: :ip,
|
@@ -39,12 +39,6 @@ RSpec.describe 'Schema inference for common datatypes', seeds: false do
|
|
39
39
|
let(:source) { ROM::Relation::Name[:tasks] }
|
40
40
|
|
41
41
|
it 'can infer attributes for dataset' do |ex|
|
42
|
-
if mysql?(ex)
|
43
|
-
indexes = { index: %i(user_id).to_set }
|
44
|
-
else
|
45
|
-
indexes = {}
|
46
|
-
end
|
47
|
-
|
48
42
|
expect(schema.to_h).
|
49
43
|
to eql(
|
50
44
|
id: ROM::SQL::Types::Serial.meta(name: :id, source: source),
|
@@ -53,8 +47,7 @@ RSpec.describe 'Schema inference for common datatypes', seeds: false do
|
|
53
47
|
name: :user_id,
|
54
48
|
foreign_key: true,
|
55
49
|
source: source,
|
56
|
-
target: :users
|
57
|
-
**indexes
|
50
|
+
target: :users
|
58
51
|
)
|
59
52
|
)
|
60
53
|
end
|
@@ -189,11 +182,11 @@ RSpec.describe 'Schema inference for common datatypes', seeds: false do
|
|
189
182
|
inferrable_relations.concat %i(people)
|
190
183
|
end
|
191
184
|
|
192
|
-
let(:relation) { container.
|
185
|
+
let(:relation) { container.relations[:people] }
|
193
186
|
|
194
187
|
before do
|
195
188
|
conf.relation(:people) do
|
196
|
-
schema(
|
189
|
+
schema(infer: true)
|
197
190
|
end
|
198
191
|
|
199
192
|
conf.commands(:people) do
|
@@ -356,20 +349,16 @@ RSpec.describe 'Schema inference for common datatypes', seeds: false do
|
|
356
349
|
|
357
350
|
index %i(bar baz), name: :composite_idx
|
358
351
|
end
|
352
|
+
|
353
|
+
conf.relation(:test_inferrence) { schema(infer: true) }
|
359
354
|
end
|
360
355
|
|
361
356
|
let(:dataset) { :test_inferrence }
|
362
357
|
let(:source) { ROM::Relation::Name[dataset] }
|
363
358
|
|
364
359
|
it 'infers types with indices' do
|
365
|
-
|
366
|
-
|
367
|
-
to eql(
|
368
|
-
id: int.meta(name: :id, source: source, primary_key: true),
|
369
|
-
foo: int.optional.meta(name: :foo, source: source, index: %i(foo_idx).to_set),
|
370
|
-
bar: int.meta(name: :bar, source: source, index: %i(bar_idx composite_idx).to_set),
|
371
|
-
baz: int.meta(name: :baz, source: source, index: %i(baz1_idx baz2_idx).to_set)
|
372
|
-
)
|
360
|
+
expect(schema.indexes.map(&:name)).
|
361
|
+
to match_array(%i(foo_idx bar_idx baz1_idx baz2_idx composite_idx))
|
373
362
|
end
|
374
363
|
end
|
375
364
|
end
|
@@ -1,12 +1,12 @@
|
|
1
|
-
RSpec.describe
|
1
|
+
RSpec.describe ROM::SQL::Wrap do
|
2
2
|
with_adapters do
|
3
3
|
include_context 'users and tasks'
|
4
4
|
|
5
|
-
describe '#
|
5
|
+
describe '#wrap' do
|
6
6
|
shared_context 'joined tuple' do
|
7
|
-
it 'returns
|
7
|
+
it 'returns nested tuples' do
|
8
8
|
task_with_user = tasks
|
9
|
-
.
|
9
|
+
.wrap(name)
|
10
10
|
.where { id.qualified.is(2) }
|
11
11
|
.one
|
12
12
|
|
@@ -17,7 +17,7 @@ RSpec.describe 'Plugins / :auto_wrap' do
|
|
17
17
|
|
18
18
|
it 'works with by_pk' do
|
19
19
|
task_with_user = tasks
|
20
|
-
.
|
20
|
+
.wrap(name)
|
21
21
|
.by_pk(1)
|
22
22
|
.one
|
23
23
|
|
@@ -26,42 +26,17 @@ RSpec.describe 'Plugins / :auto_wrap' do
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
context 'when parent relation is registered under dataset name' do
|
30
|
-
before do
|
31
|
-
conf.relation(:tasks) { schema(infer: true) }
|
32
|
-
conf.relation(:users) { schema(infer: true) }
|
33
|
-
end
|
34
|
-
|
35
|
-
include_context 'joined tuple' do
|
36
|
-
let(:name) { :users }
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
context 'when parent relation is registered under a custom name' do
|
41
|
-
before do
|
42
|
-
conf.relation(:tasks) { schema(infer: true) }
|
43
|
-
conf.relation(:authors) { schema(:users, infer: true) }
|
44
|
-
end
|
45
|
-
|
46
|
-
include_context 'joined tuple' do
|
47
|
-
let(:users) { relations[:authors] }
|
48
|
-
let(:name) { :authors}
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
29
|
context 'using association with inferred relation name' do
|
53
30
|
before do
|
54
31
|
conf.relation(:tasks) do
|
32
|
+
auto_map false
|
33
|
+
|
55
34
|
schema(infer: true) do
|
56
35
|
associations do
|
57
36
|
belongs_to :user
|
58
37
|
end
|
59
38
|
end
|
60
39
|
end
|
61
|
-
|
62
|
-
conf.relation(:users) do
|
63
|
-
schema(infer: true)
|
64
|
-
end
|
65
40
|
end
|
66
41
|
|
67
42
|
include_context 'joined tuple' do
|
@@ -72,16 +47,14 @@ RSpec.describe 'Plugins / :auto_wrap' do
|
|
72
47
|
context 'using association with an alias' do
|
73
48
|
before do
|
74
49
|
conf.relation(:tasks) do
|
50
|
+
auto_map false
|
51
|
+
|
75
52
|
schema(infer: true) do
|
76
53
|
associations do
|
77
54
|
belongs_to :users, as: :assignee
|
78
55
|
end
|
79
56
|
end
|
80
57
|
end
|
81
|
-
|
82
|
-
conf.relation(:users) do
|
83
|
-
schema(infer: true)
|
84
|
-
end
|
85
58
|
end
|
86
59
|
|
87
60
|
include_context 'joined tuple' do
|
@@ -92,6 +65,8 @@ RSpec.describe 'Plugins / :auto_wrap' do
|
|
92
65
|
context 'using association with an aliased relation' do
|
93
66
|
before do
|
94
67
|
conf.relation(:tasks) do
|
68
|
+
auto_map false
|
69
|
+
|
95
70
|
schema(infer: true) do
|
96
71
|
associations do
|
97
72
|
belongs_to :users, as: :assignee, relation: :people
|
@@ -100,6 +75,8 @@ RSpec.describe 'Plugins / :auto_wrap' do
|
|
100
75
|
end
|
101
76
|
|
102
77
|
conf.relation(:people) do
|
78
|
+
auto_map false
|
79
|
+
|
103
80
|
schema(:users, infer: true)
|
104
81
|
end
|
105
82
|
end
|
data/spec/shared/accounts.rb
CHANGED
@@ -32,6 +32,10 @@ RSpec.shared_context 'accounts' do
|
|
32
32
|
Integer :card_id
|
33
33
|
String :service
|
34
34
|
end
|
35
|
+
|
36
|
+
conf.relation(:accounts) { schema(infer: true) }
|
37
|
+
conf.relation(:cards) { schema(infer: true) }
|
38
|
+
conf.relation(:subscriptions) { schema(infer: true) }
|
35
39
|
end
|
36
40
|
|
37
41
|
before do |example|
|
@@ -29,13 +29,14 @@ RSpec.shared_context 'database setup' do
|
|
29
29
|
let(:conn) { Sequel.connect(uri) }
|
30
30
|
let(:database_type) { conn.database_type }
|
31
31
|
let(:inferrable_relations) { [] }
|
32
|
-
let(:conf) {
|
32
|
+
let(:conf) { TestConfiguration.new(:sql, conn) }
|
33
33
|
let(:container) { ROM.container(conf) }
|
34
34
|
let(:relations) { container.relations }
|
35
35
|
let(:commands) { container.commands }
|
36
36
|
|
37
37
|
before do
|
38
38
|
conn.loggers << LOGGER
|
39
|
+
inferrable_relations.each { |name| conf.relation(name) { schema(infer: true) } }
|
39
40
|
end
|
40
41
|
|
41
42
|
after do
|
data/spec/shared/notes.rb
CHANGED
data/spec/shared/posts.rb
CHANGED
data/spec/shared/puppies.rb
CHANGED
data/spec/shared/relations.rb
CHANGED
data/spec/shared/users.rb
CHANGED