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.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +13 -7
  3. data/Gemfile +7 -5
  4. data/lib/rom/plugins/relation/sql/auto_restrictions.rb +11 -17
  5. data/lib/rom/sql.rb +3 -2
  6. data/lib/rom/sql/associations.rb +5 -0
  7. data/lib/rom/sql/associations/core.rb +20 -0
  8. data/lib/rom/sql/associations/many_to_many.rb +83 -0
  9. data/lib/rom/sql/associations/many_to_one.rb +55 -0
  10. data/lib/rom/sql/associations/one_to_many.rb +31 -0
  11. data/lib/rom/sql/{association → associations}/one_to_one.rb +3 -2
  12. data/lib/rom/sql/{association → associations}/one_to_one_through.rb +3 -2
  13. data/lib/rom/sql/associations/self_ref.rb +39 -0
  14. data/lib/rom/sql/attribute.rb +44 -54
  15. data/lib/rom/sql/errors.rb +2 -0
  16. data/lib/rom/sql/extensions/mysql.rb +1 -1
  17. data/lib/rom/sql/extensions/mysql/attributes_inferrer.rb +10 -0
  18. data/lib/rom/sql/extensions/postgres.rb +1 -1
  19. data/lib/rom/sql/extensions/postgres/{inferrer.rb → attributes_inferrer.rb} +4 -4
  20. data/lib/rom/sql/extensions/postgres/types.rb +9 -19
  21. data/lib/rom/sql/extensions/sqlite.rb +1 -1
  22. data/lib/rom/sql/extensions/sqlite/{inferrer.rb → attributes_inferrer.rb} +2 -2
  23. data/lib/rom/sql/gateway.rb +29 -30
  24. data/lib/rom/sql/index.rb +13 -0
  25. data/lib/rom/sql/migration.rb +10 -0
  26. data/lib/rom/sql/migration/inline_runner.rb +86 -0
  27. data/lib/rom/sql/migration/migrator.rb +17 -0
  28. data/lib/rom/sql/migration/schema_diff.rb +177 -0
  29. data/lib/rom/sql/plugin/associates.rb +11 -45
  30. data/lib/rom/sql/plugin/pagination.rb +4 -4
  31. data/lib/rom/sql/relation.rb +22 -42
  32. data/lib/rom/sql/relation/reading.rb +3 -3
  33. data/lib/rom/sql/schema.rb +14 -21
  34. data/lib/rom/sql/schema/associations_dsl.rb +7 -6
  35. data/lib/rom/sql/schema/attributes_inferrer.rb +164 -0
  36. data/lib/rom/sql/schema/inferrer.rb +40 -141
  37. data/lib/rom/sql/type_extensions.rb +44 -0
  38. data/lib/rom/sql/version.rb +1 -1
  39. data/lib/rom/sql/wrap.rb +25 -0
  40. data/rom-sql.gemspec +2 -2
  41. data/spec/integration/{association → associations}/many_to_many/custom_fks_spec.rb +4 -2
  42. data/spec/integration/{association → associations}/many_to_many/from_view_spec.rb +2 -2
  43. data/spec/integration/{association → associations}/many_to_many_spec.rb +25 -30
  44. data/spec/integration/{association → associations}/many_to_one/custom_fks_spec.rb +5 -3
  45. data/spec/integration/{association → associations}/many_to_one/from_view_spec.rb +3 -3
  46. data/spec/integration/{association → associations}/many_to_one/self_ref_spec.rb +2 -2
  47. data/spec/integration/{association → associations}/many_to_one_spec.rb +20 -38
  48. data/spec/integration/{association → associations}/one_to_many/custom_fks_spec.rb +4 -2
  49. data/spec/integration/{association → associations}/one_to_many/from_view_spec.rb +2 -2
  50. data/spec/integration/{association → associations}/one_to_many/self_ref_spec.rb +2 -2
  51. data/spec/integration/{association → associations}/one_to_many_spec.rb +24 -11
  52. data/spec/integration/{association → associations}/one_to_one_spec.rb +13 -9
  53. data/spec/integration/{association → associations}/one_to_one_through_spec.rb +15 -11
  54. data/spec/integration/auto_migrations/errors_spec.rb +31 -0
  55. data/spec/integration/auto_migrations/indexes_spec.rb +109 -0
  56. data/spec/integration/auto_migrations/managing_columns_spec.rb +156 -0
  57. data/spec/integration/auto_migrations/postgres/column_types_spec.rb +63 -0
  58. data/spec/integration/commands/create_spec.rb +2 -4
  59. data/spec/integration/commands/delete_spec.rb +2 -2
  60. data/spec/integration/commands/update_spec.rb +2 -0
  61. data/spec/integration/graph_spec.rb +9 -3
  62. data/spec/integration/plugins/associates_spec.rb +16 -55
  63. data/spec/integration/plugins/auto_restrictions_spec.rb +0 -11
  64. data/spec/integration/relation_schema_spec.rb +49 -25
  65. data/spec/integration/schema/inferrer/postgres_spec.rb +1 -1
  66. data/spec/integration/schema/inferrer_spec.rb +7 -18
  67. data/spec/integration/setup_spec.rb +4 -0
  68. data/spec/integration/{plugins/auto_wrap_spec.rb → wrap_spec.rb} +13 -36
  69. data/spec/shared/accounts.rb +4 -0
  70. data/spec/shared/database_setup.rb +2 -1
  71. data/spec/shared/notes.rb +2 -0
  72. data/spec/shared/posts.rb +2 -0
  73. data/spec/shared/puppies.rb +2 -0
  74. data/spec/shared/relations.rb +2 -2
  75. data/spec/shared/users.rb +2 -0
  76. data/spec/shared/users_and_tasks.rb +4 -0
  77. data/spec/spec_helper.rb +3 -6
  78. data/spec/support/helpers.rb +11 -8
  79. data/spec/support/test_configuration.rb +16 -0
  80. data/spec/unit/plugin/associates_spec.rb +5 -10
  81. data/spec/unit/plugin/pagination_spec.rb +9 -9
  82. data/spec/unit/plugin/timestamp_spec.rb +9 -9
  83. data/spec/unit/relation/dataset_spec.rb +7 -5
  84. data/spec/unit/relation/inner_join_spec.rb +2 -15
  85. data/spec/unit/relation/primary_key_spec.rb +1 -1
  86. data/spec/unit/schema_spec.rb +6 -4
  87. metadata +65 -70
  88. data/lib/rom/plugins/relation/sql/auto_combine.rb +0 -71
  89. data/lib/rom/plugins/relation/sql/auto_wrap.rb +0 -62
  90. data/lib/rom/sql/association.rb +0 -103
  91. data/lib/rom/sql/association/many_to_many.rb +0 -119
  92. data/lib/rom/sql/association/many_to_one.rb +0 -73
  93. data/lib/rom/sql/association/name.rb +0 -78
  94. data/lib/rom/sql/association/one_to_many.rb +0 -60
  95. data/lib/rom/sql/extensions/mysql/inferrer.rb +0 -10
  96. data/lib/rom/sql/qualified_attribute.rb +0 -53
  97. data/lib/rom/sql/schema/dsl.rb +0 -75
  98. data/spec/unit/association/many_to_many_spec.rb +0 -89
  99. data/spec/unit/association/many_to_one_spec.rb +0 -81
  100. data/spec/unit/association/name_spec.rb +0 -68
  101. data/spec/unit/association/one_to_many_spec.rb +0 -82
  102. data/spec/unit/association/one_to_one_spec.rb +0 -83
  103. data/spec/unit/association/one_to_one_through_spec.rb +0 -69
@@ -32,6 +32,10 @@ RSpec.shared_context 'users and tasks' do
32
32
  Integer :tag_id
33
33
  Integer :task_id
34
34
  end
35
+
36
+ conf.relation(:tasks) { schema(infer: true) }
37
+ conf.relation(:task_tags) { schema(infer: true) }
38
+ conf.relation(:tags) { schema(infer: true) }
35
39
  end
36
40
 
37
41
  before do |example|
data/spec/spec_helper.rb CHANGED
@@ -21,7 +21,7 @@ require 'logger'
21
21
  require 'tempfile'
22
22
 
23
23
  begin
24
- require 'pry-byebug'
24
+ require ENV['DEBUGGER'] || 'byebug'
25
25
  rescue LoadError
26
26
  require 'pry'
27
27
  end
@@ -59,11 +59,8 @@ SPEC_ROOT = root = Pathname(__FILE__).dirname
59
59
 
60
60
  TMP_PATH = root.join('../tmp')
61
61
 
62
- class ROM::SQL::Schema::Inferrer
63
- def self.on_error(*)
64
- # quiet in specs
65
- end
66
- end
62
+ # quiet in specs
63
+ ROM::SQL::Relation.tap { |r| r.schema_inferrer(r.schema_inferrer.suppress_errors) }
67
64
 
68
65
  require 'dry/core/deprecations'
69
66
  Dry::Core::Deprecations.set_logger!(root.join('../log/deprecations.log'))
@@ -1,16 +1,13 @@
1
1
  module Helpers
2
- def qualified_attribute(*args)
3
- ROM::SQL::QualifiedAttribute[*args]
4
- end
5
-
6
2
  def assoc_name(*args)
7
- ROM::SQL::Association::Name[*args]
3
+ ROM::Relation::Name[*args]
8
4
  end
9
5
 
10
- def define_schema(name, attrs)
6
+ def define_schema(name, attrs = [])
7
+ relation_name = ROM::Relation::Name.new(name)
11
8
  ROM::SQL::Schema.define(
12
- name,
13
- attributes: attrs.map { |key, value| value.meta(name: key, source: ROM::Relation::Name.new(name)) },
9
+ relation_name,
10
+ attributes: attrs.map { |key, value| value.meta(name: key, source: relation_name) },
14
11
  attr_class: ROM::SQL::Attribute
15
12
  )
16
13
  end
@@ -18,4 +15,10 @@ module Helpers
18
15
  def define_type(name, id, **opts)
19
16
  ROM::SQL::Attribute.new(ROM::Types.const_get(id).meta(name: name, **opts))
20
17
  end
18
+
19
+ def build_assoc(type, *args)
20
+ klass = Dry::Core::Inflector.classify(type)
21
+ definition = ROM::Associations::Definitions.const_get(klass).new(*args)
22
+ ROM::SQL::Associations.const_get(definition.type).new(definition, relations)
23
+ end
21
24
  end
@@ -0,0 +1,16 @@
1
+ require 'rom/configuration'
2
+
3
+ class TestConfiguration < ROM::Configuration
4
+ def relation(name, &block)
5
+ if registered_relation_names.include?(name)
6
+ setup.relation_classes.delete_if do |klass|
7
+ klass.relation_name.relation == name
8
+ end
9
+ end
10
+ super
11
+ end
12
+
13
+ def registered_relation_names
14
+ setup.relation_classes.map(&:relation_name).map(&:relation)
15
+ end
16
+ end
@@ -18,10 +18,6 @@ RSpec.describe ROM::SQL::Plugin::Associates do
18
18
  instance_double(ROM::SQL::Relation)
19
19
  end
20
20
 
21
- let(:registry) do
22
- Hash.new { |h, k| h.fetch(k.to_sym) }.update(posts: posts, tags: tags)
23
- end
24
-
25
21
  let(:command_class) do
26
22
  Class.new(ROM::SQL::Commands::Create) do
27
23
  use :associates, tags: []
@@ -33,23 +29,22 @@ RSpec.describe ROM::SQL::Plugin::Associates do
33
29
  end
34
30
 
35
31
  let(:tags_assoc) do
36
- ROM::SQL::Association::ManyToMany.new(:posts, :tags, through: :posts_tags)
32
+ ROM::SQL::Associations::ManyToMany.new(double(:definition).as_null_object, {})
37
33
  end
38
34
 
39
35
  let(:posts_assoc) do
40
- ROM::SQL::Association::ManyToMany.new(:tags, :posts, through: :posts_tags)
36
+ ROM::SQL::Associations::ManyToMany.new(double(:definition).as_null_object, {})
41
37
  end
42
38
 
43
39
  before do
44
- allow(posts).to receive(:__registry__).and_return(registry)
45
- allow(associations).to receive(:try).and_yield(tags_assoc)
40
+ allow(associations).to receive(:[]).and_return(tags_assoc)
46
41
  allow(tags_assoc).to receive(:join_keys).and_return({})
47
42
  end
48
43
 
49
44
  shared_context 'associates result' do
50
45
  it 'inserts join tuples and returns child tuples with combine keys' do
51
- expect(tags_assoc).to receive(:persist).with(registry, post_tuples, tag_tuples)
52
- expect(tags_assoc).to receive(:parent_combine_keys).with(registry).and_return(%i[name tag])
46
+ expect(tags_assoc).to receive(:persist).with(post_tuples, tag_tuples)
47
+ expect(tags_assoc).to receive(:parent_combine_keys).and_return(%i[name tag])
53
48
 
54
49
  result = command.associate(post_tuples, tag_tuples, assoc: tags_assoc, keys: {})
55
50
 
@@ -17,13 +17,13 @@ RSpec.describe 'Plugin / Pagination', seeds: false do
17
17
  describe '#page' do
18
18
  it 'allow to call with stringify number' do
19
19
  expect {
20
- container.relation(:users).page('5')
20
+ container.relations[:users].page('5')
21
21
  }.to_not raise_error
22
22
  end
23
23
 
24
24
  it 'preserves existing modifiers' do
25
25
  expect(
26
- container.relation(:users).send(:where, name: 'User 2').page(1).to_a.size
26
+ container.relations[:users].send(:where, name: 'User 2').page(1).to_a.size
27
27
  ).to be(1)
28
28
  end
29
29
  end
@@ -31,12 +31,12 @@ RSpec.describe 'Plugin / Pagination', seeds: false do
31
31
  describe '#per_page' do
32
32
  it 'allow to call with stringify number' do
33
33
  expect {
34
- container.relation(:users).per_page('5')
34
+ container.relations[:users].per_page('5')
35
35
  }.to_not raise_error
36
36
  end
37
37
 
38
38
  it 'returns paginated relation with provided limit' do
39
- users = container.relation(:users).page(2).per_page(5)
39
+ users = container.relations[:users].page(2).per_page(5)
40
40
 
41
41
  expect(users.dataset.opts[:offset]).to eql(5)
42
42
  expect(users.dataset.opts[:limit]).to eql(5)
@@ -54,19 +54,19 @@ RSpec.describe 'Plugin / Pagination', seeds: false do
54
54
 
55
55
  describe '#total_pages' do
56
56
  it 'returns a single page when elements are a perfect fit' do
57
- users = container.relation(:users).page(1).per_page(3)
57
+ users = container.relations[:users].page(1).per_page(3)
58
58
  expect(users.pager.total_pages).to eql(3)
59
59
  end
60
60
 
61
61
  it 'returns the exact number of pages to accommodate all elements' do
62
- users = container.relation(:users).per_page(9)
62
+ users = container.relations[:users].per_page(9)
63
63
  expect(users.pager.total_pages).to eql(1)
64
64
  end
65
65
  end
66
66
 
67
67
  describe '#pager' do
68
68
  it 'returns a pager with pagination meta-info' do
69
- users = container.relation(:users).page(1)
69
+ users = container.relations[:users].page(1)
70
70
 
71
71
  expect(users.pager.total).to be(9)
72
72
  expect(users.pager.total_pages).to be(3)
@@ -75,13 +75,13 @@ RSpec.describe 'Plugin / Pagination', seeds: false do
75
75
  expect(users.pager.next_page).to be(2)
76
76
  expect(users.pager.prev_page).to be(nil)
77
77
 
78
- users = container.relation(:users).page(2)
78
+ users = container.relations[:users].page(2)
79
79
 
80
80
  expect(users.pager.current_page).to be(2)
81
81
  expect(users.pager.next_page).to be(3)
82
82
  expect(users.pager.prev_page).to be(1)
83
83
 
84
- users = container.relation(:users).page(3)
84
+ users = container.relations[:users].page(3)
85
85
 
86
86
  expect(users.pager.next_page).to be(nil)
87
87
  expect(users.pager.prev_page).to be(2)
@@ -46,7 +46,7 @@ RSpec.describe 'Plugin / Timestamp' do
46
46
 
47
47
  it "applies timestamps by default" do
48
48
  time = DateTime.now
49
- result = container.command(:notes).create.call(text: "This is a test")
49
+ result = container.commands[:notes].create.call(text: "This is a test")
50
50
 
51
51
  created = DateTime.parse(result[:created_at].to_s)
52
52
  updated = DateTime.parse(result[:updated_at].to_s)
@@ -56,7 +56,7 @@ RSpec.describe 'Plugin / Timestamp' do
56
56
  end
57
57
 
58
58
  it "applies datestamps by default" do
59
- result = container.command(:notes).create.call(text: "This is a test")
59
+ result = container.commands[:notes].create.call(text: "This is a test")
60
60
  expect(Date.parse(result[:written].to_s)).to eq Date.today
61
61
  end
62
62
 
@@ -64,7 +64,7 @@ RSpec.describe 'Plugin / Timestamp' do
64
64
  time = DateTime.now
65
65
  input = [{text: "note one"}, {text: "note two"}]
66
66
 
67
- results = container.command(:notes).create_many.call(input)
67
+ results = container.commands[:notes].create_many.call(input)
68
68
 
69
69
  results.each do |result|
70
70
  created = DateTime.parse(result[:created_at].to_s)
@@ -74,10 +74,10 @@ RSpec.describe 'Plugin / Timestamp' do
74
74
  end
75
75
 
76
76
  it "only updates specified timestamps" do
77
- initial = container.command(:notes).create.call(text: "testing")
77
+ initial = container.commands[:notes].create.call(text: "testing")
78
78
  sleep 1 # Unfortunate, but unless I start injecting clocks into the
79
79
  # command, this is needed to make sure the time actually changes
80
- updated = container.command(:notes).update.call(text: "updated test").first
80
+ updated = container.commands[:notes].update.call(text: "updated test").first
81
81
 
82
82
  expect(updated[:created_at]).to eq initial[:created_at]
83
83
  expect(updated[:updated_at]).not_to eq initial[:updated_at]
@@ -86,8 +86,8 @@ RSpec.describe 'Plugin / Timestamp' do
86
86
  it "allows overriding timestamps" do |ex|
87
87
  tomorrow = (Time.now + (60 * 60 * 24))
88
88
 
89
- container.command(:notes).create.call(text: "testing")
90
- updated = container.command(:notes).update.call(text: "updated test", updated_at: tomorrow).first
89
+ container.commands[:notes].create.call(text: "testing")
90
+ updated = container.commands[:notes].update.call(text: "updated test", updated_at: tomorrow).first
91
91
 
92
92
  if jruby? && sqlite?(ex)
93
93
  expect(updated[:updated_at]).to eql(tomorrow.strftime('%Y-%m-%d %H:%M:%S.%6N'))
@@ -97,8 +97,8 @@ RSpec.describe 'Plugin / Timestamp' do
97
97
  end
98
98
 
99
99
  it "works with chained commands" do
100
- create_user = container.command(:users).create.with(name: "John Doe")
101
- create_note = container.command(:notes).create_with_user.with(text: "new note")
100
+ create_user = container.commands[:users].create.with(name: "John Doe")
101
+ create_note = container.commands[:notes].create_with_user.with(text: "new note")
102
102
 
103
103
  time = DateTime.now
104
104
  command = create_user >> create_note
@@ -17,7 +17,8 @@ RSpec.describe ROM::Relation, '#dataset' do
17
17
  end
18
18
 
19
19
  it 'uses schema to infer default dataset' do
20
- expect(relation.dataset.sql).to eql(dataset.select(:id, :name).order(Sequel.qualify(:users, :id)).sql)
20
+ expect(relation.dataset.sql).
21
+ to eql(dataset.select(Sequel.qualify(:users, :id), Sequel.qualify(:users, :name)).order(Sequel.qualify(:users, :id)).sql)
21
22
  end
22
23
  end
23
24
 
@@ -31,17 +32,18 @@ RSpec.describe ROM::Relation, '#dataset' do
31
32
  end
32
33
 
33
34
  it 'uses schema to infer default dataset' do
34
- expect(relation.dataset.sql).to eql(dataset.select(:id).order(Sequel.qualify(:users, :id)).sql)
35
+ expect(relation.dataset.sql).
36
+ to eql(dataset.select(Sequel.qualify(:users, :id)).order(Sequel.qualify(:users, :id)).sql)
35
37
  end
36
38
  end
37
39
 
38
- context 'without schema' do
40
+ context 'with inferred schema' do
39
41
  before do
40
- conf.relation(:users)
42
+ conf.relation(:users) { schema(infer: true) }
41
43
  end
42
44
 
43
45
  it 'selects all qualified columns and sorts by pk' do
44
- expect(relation.dataset.sql).to eql(dataset.select(*relation.columns).order(Sequel.qualify(:users, :id)).sql)
46
+ expect(relation.dataset.sql).to eql(dataset.select(*relation.schema.qualified).order(Sequel.qualify(:users, :id)).sql)
45
47
  end
46
48
  end
47
49
  end
@@ -149,23 +149,10 @@ RSpec.describe ROM::Relation, '#inner_join' do
149
149
  end
150
150
 
151
151
  it 'joins by relation if association name differs from relation name' do
152
- pending 'waits for support for joins by aliased relation'
153
- result = puzzles.inner_join(users).select(:name, puzzles[:text])
152
+ result = puzzles.inner_join(users).select(users[:name], puzzles[:text])
154
153
 
155
- expect(result.to_a).to eql([ name: 'Jane', title: "Jane's task" ])
154
+ expect(result.to_a).to eql([ name: 'Jane', text: "solved by Jane" ])
156
155
  end
157
156
  end
158
-
159
- it 'raises error when column names are ambiguous' do
160
- expect {
161
- relation.inner_join(:tasks, user_id: :id).to_a
162
- }.to raise_error(Sequel::DatabaseError, /ambiguous/)
163
- end
164
-
165
- it 'raises error when join arg is unsupported' do
166
- expect {
167
- relation.inner_join(421)
168
- }.to raise_error(ArgumentError, /other/)
169
- end
170
157
  end
171
158
  end
@@ -18,7 +18,7 @@ RSpec.describe ROM::Relation, '#primary_key' do
18
18
 
19
19
  context 'without schema' do
20
20
  it 'returns :id by default' do
21
- conf.relation(:users)
21
+ conf.relation(:users) { schema(infer: true) }
22
22
 
23
23
  expect(relation.primary_key).to be(:id)
24
24
  end
@@ -1,21 +1,23 @@
1
1
  RSpec.describe ROM::SQL::Schema, :postgres do
2
2
  describe '#primary_key' do
3
3
  it 'returns primary key attributes' do
4
- schema = Class.new(ROM::Relation[:sql]).schema do
4
+ schema_proc = Class.new(ROM::Relation[:sql]).schema do
5
5
  attribute :id, ROM::SQL::Types::Serial
6
6
  end
7
7
 
8
- schema.finalize!
8
+ schema = schema_proc.call
9
+ schema.finalize_attributes!.finalize!
9
10
 
10
11
  expect(schema.primary_key).to eql([schema[:id]])
11
12
  end
12
13
 
13
14
  it 'returns empty array when there is no PK defined' do
14
- schema = Class.new(ROM::Relation[:sql]).schema do
15
+ schema_proc = Class.new(ROM::Relation[:sql]).schema do
15
16
  attribute :id, ROM::SQL::Types::Int
16
17
  end
17
18
 
18
- schema.finalize!
19
+ schema = schema_proc.call
20
+ schema.finalize_attributes!.finalize!
19
21
 
20
22
  expect(schema.primary_key).to eql([])
21
23
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rom-sql
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.5
4
+ version: 2.0.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Solnica
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-12 00:00:00.000000000 Z
11
+ date: 2017-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sequel
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.11.0
47
+ version: '0.11'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.11.0
54
+ version: '0.11'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: dry-core
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -67,25 +67,19 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0.3'
69
69
  - !ruby/object:Gem::Dependency
70
- name: rom
70
+ name: rom-core
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '3.2'
76
- - - ">="
77
- - !ruby/object:Gem::Version
78
- version: 3.2.2
75
+ version: 4.0.0.beta
79
76
  type: :runtime
80
77
  prerelease: false
81
78
  version_requirements: !ruby/object:Gem::Requirement
82
79
  requirements:
83
80
  - - "~>"
84
81
  - !ruby/object:Gem::Version
85
- version: '3.2'
86
- - - ">="
87
- - !ruby/object:Gem::Version
88
- version: 3.2.2
82
+ version: 4.0.0.beta
89
83
  - !ruby/object:Gem::Dependency
90
84
  name: bundler
91
85
  requirement: !ruby/object:Gem::Requirement
@@ -148,18 +142,17 @@ files:
148
142
  - Rakefile
149
143
  - circle.yml
150
144
  - lib/rom-sql.rb
151
- - lib/rom/plugins/relation/sql/auto_combine.rb
152
145
  - lib/rom/plugins/relation/sql/auto_restrictions.rb
153
- - lib/rom/plugins/relation/sql/auto_wrap.rb
154
146
  - lib/rom/plugins/relation/sql/instrumentation.rb
155
147
  - lib/rom/sql.rb
156
- - lib/rom/sql/association.rb
157
- - lib/rom/sql/association/many_to_many.rb
158
- - lib/rom/sql/association/many_to_one.rb
159
- - lib/rom/sql/association/name.rb
160
- - lib/rom/sql/association/one_to_many.rb
161
- - lib/rom/sql/association/one_to_one.rb
162
- - lib/rom/sql/association/one_to_one_through.rb
148
+ - lib/rom/sql/associations.rb
149
+ - lib/rom/sql/associations/core.rb
150
+ - lib/rom/sql/associations/many_to_many.rb
151
+ - lib/rom/sql/associations/many_to_one.rb
152
+ - lib/rom/sql/associations/one_to_many.rb
153
+ - lib/rom/sql/associations/one_to_one.rb
154
+ - lib/rom/sql/associations/one_to_one_through.rb
155
+ - lib/rom/sql/associations/self_ref.rb
163
156
  - lib/rom/sql/attribute.rb
164
157
  - lib/rom/sql/commands.rb
165
158
  - lib/rom/sql/commands/create.rb
@@ -173,20 +166,23 @@ files:
173
166
  - lib/rom/sql/extensions.rb
174
167
  - lib/rom/sql/extensions/active_support_notifications.rb
175
168
  - lib/rom/sql/extensions/mysql.rb
176
- - lib/rom/sql/extensions/mysql/inferrer.rb
169
+ - lib/rom/sql/extensions/mysql/attributes_inferrer.rb
177
170
  - lib/rom/sql/extensions/postgres.rb
171
+ - lib/rom/sql/extensions/postgres/attributes_inferrer.rb
178
172
  - lib/rom/sql/extensions/postgres/commands.rb
179
- - lib/rom/sql/extensions/postgres/inferrer.rb
180
173
  - lib/rom/sql/extensions/postgres/types.rb
181
174
  - lib/rom/sql/extensions/rails_log_subscriber.rb
182
175
  - lib/rom/sql/extensions/sqlite.rb
183
- - lib/rom/sql/extensions/sqlite/inferrer.rb
176
+ - lib/rom/sql/extensions/sqlite/attributes_inferrer.rb
184
177
  - lib/rom/sql/extensions/sqlite/types.rb
185
178
  - lib/rom/sql/function.rb
186
179
  - lib/rom/sql/gateway.rb
187
180
  - lib/rom/sql/group_dsl.rb
181
+ - lib/rom/sql/index.rb
188
182
  - lib/rom/sql/migration.rb
183
+ - lib/rom/sql/migration/inline_runner.rb
189
184
  - lib/rom/sql/migration/migrator.rb
185
+ - lib/rom/sql/migration/schema_diff.rb
190
186
  - lib/rom/sql/migration/template.rb
191
187
  - lib/rom/sql/order_dsl.rb
192
188
  - lib/rom/sql/plugin/associates.rb
@@ -194,7 +190,6 @@ files:
194
190
  - lib/rom/sql/plugin/timestamps.rb
195
191
  - lib/rom/sql/plugins.rb
196
192
  - lib/rom/sql/projection_dsl.rb
197
- - lib/rom/sql/qualified_attribute.rb
198
193
  - lib/rom/sql/rake_task.rb
199
194
  - lib/rom/sql/relation.rb
200
195
  - lib/rom/sql/relation/reading.rb
@@ -203,13 +198,15 @@ files:
203
198
  - lib/rom/sql/restriction_dsl.rb
204
199
  - lib/rom/sql/schema.rb
205
200
  - lib/rom/sql/schema/associations_dsl.rb
206
- - lib/rom/sql/schema/dsl.rb
201
+ - lib/rom/sql/schema/attributes_inferrer.rb
207
202
  - lib/rom/sql/schema/inferrer.rb
208
203
  - lib/rom/sql/spec/support.rb
209
204
  - lib/rom/sql/tasks/migration_tasks.rake
210
205
  - lib/rom/sql/transaction.rb
206
+ - lib/rom/sql/type_extensions.rb
211
207
  - lib/rom/sql/types.rb
212
208
  - lib/rom/sql/version.rb
209
+ - lib/rom/sql/wrap.rb
213
210
  - log/.gitkeep
214
211
  - rom-sql.gemspec
215
212
  - spec/extensions/postgres/attribute_spec.rb
@@ -217,19 +214,23 @@ files:
217
214
  - spec/extensions/postgres/types_spec.rb
218
215
  - spec/extensions/sqlite/types_spec.rb
219
216
  - spec/fixtures/migrations/20150403090603_create_carrots.rb
220
- - spec/integration/association/many_to_many/custom_fks_spec.rb
221
- - spec/integration/association/many_to_many/from_view_spec.rb
222
- - spec/integration/association/many_to_many_spec.rb
223
- - spec/integration/association/many_to_one/custom_fks_spec.rb
224
- - spec/integration/association/many_to_one/from_view_spec.rb
225
- - spec/integration/association/many_to_one/self_ref_spec.rb
226
- - spec/integration/association/many_to_one_spec.rb
227
- - spec/integration/association/one_to_many/custom_fks_spec.rb
228
- - spec/integration/association/one_to_many/from_view_spec.rb
229
- - spec/integration/association/one_to_many/self_ref_spec.rb
230
- - spec/integration/association/one_to_many_spec.rb
231
- - spec/integration/association/one_to_one_spec.rb
232
- - spec/integration/association/one_to_one_through_spec.rb
217
+ - spec/integration/associations/many_to_many/custom_fks_spec.rb
218
+ - spec/integration/associations/many_to_many/from_view_spec.rb
219
+ - spec/integration/associations/many_to_many_spec.rb
220
+ - spec/integration/associations/many_to_one/custom_fks_spec.rb
221
+ - spec/integration/associations/many_to_one/from_view_spec.rb
222
+ - spec/integration/associations/many_to_one/self_ref_spec.rb
223
+ - spec/integration/associations/many_to_one_spec.rb
224
+ - spec/integration/associations/one_to_many/custom_fks_spec.rb
225
+ - spec/integration/associations/one_to_many/from_view_spec.rb
226
+ - spec/integration/associations/one_to_many/self_ref_spec.rb
227
+ - spec/integration/associations/one_to_many_spec.rb
228
+ - spec/integration/associations/one_to_one_spec.rb
229
+ - spec/integration/associations/one_to_one_through_spec.rb
230
+ - spec/integration/auto_migrations/errors_spec.rb
231
+ - spec/integration/auto_migrations/indexes_spec.rb
232
+ - spec/integration/auto_migrations/managing_columns_spec.rb
233
+ - spec/integration/auto_migrations/postgres/column_types_spec.rb
233
234
  - spec/integration/commands/create_spec.rb
234
235
  - spec/integration/commands/delete_spec.rb
235
236
  - spec/integration/commands/update_spec.rb
@@ -240,7 +241,6 @@ files:
240
241
  - spec/integration/plugins/associates/many_to_many_spec.rb
241
242
  - spec/integration/plugins/associates_spec.rb
242
243
  - spec/integration/plugins/auto_restrictions_spec.rb
243
- - spec/integration/plugins/auto_wrap_spec.rb
244
244
  - spec/integration/relation_schema_spec.rb
245
245
  - spec/integration/schema/call_spec.rb
246
246
  - spec/integration/schema/inferrer/mysql_spec.rb
@@ -255,6 +255,7 @@ files:
255
255
  - spec/integration/setup_spec.rb
256
256
  - spec/integration/support/active_support_notifications_spec.rb
257
257
  - spec/integration/support/rails_log_subscriber_spec.rb
258
+ - spec/integration/wrap_spec.rb
258
259
  - spec/shared/accounts.rb
259
260
  - spec/shared/database_setup.rb
260
261
  - spec/shared/notes.rb
@@ -268,12 +269,7 @@ files:
268
269
  - spec/support/helpers.rb
269
270
  - spec/support/oracle/create_users.sql
270
271
  - spec/support/oracle/set_sys_passwords.sql
271
- - spec/unit/association/many_to_many_spec.rb
272
- - spec/unit/association/many_to_one_spec.rb
273
- - spec/unit/association/name_spec.rb
274
- - spec/unit/association/one_to_many_spec.rb
275
- - spec/unit/association/one_to_one_spec.rb
276
- - spec/unit/association/one_to_one_through_spec.rb
272
+ - spec/support/test_configuration.rb
277
273
  - spec/unit/attribute_spec.rb
278
274
  - spec/unit/function_spec.rb
279
275
  - spec/unit/gateway_spec.rb
@@ -340,12 +336,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
340
336
  version: '0'
341
337
  required_rubygems_version: !ruby/object:Gem::Requirement
342
338
  requirements:
343
- - - ">="
339
+ - - ">"
344
340
  - !ruby/object:Gem::Version
345
- version: '0'
341
+ version: 1.3.1
346
342
  requirements: []
347
343
  rubyforge_project:
348
- rubygems_version: 2.6.13
344
+ rubygems_version: 2.6.12
349
345
  signing_key:
350
346
  specification_version: 4
351
347
  summary: SQL databases support for ROM
@@ -355,19 +351,23 @@ test_files:
355
351
  - spec/extensions/postgres/types_spec.rb
356
352
  - spec/extensions/sqlite/types_spec.rb
357
353
  - spec/fixtures/migrations/20150403090603_create_carrots.rb
358
- - spec/integration/association/many_to_many/custom_fks_spec.rb
359
- - spec/integration/association/many_to_many/from_view_spec.rb
360
- - spec/integration/association/many_to_many_spec.rb
361
- - spec/integration/association/many_to_one/custom_fks_spec.rb
362
- - spec/integration/association/many_to_one/from_view_spec.rb
363
- - spec/integration/association/many_to_one/self_ref_spec.rb
364
- - spec/integration/association/many_to_one_spec.rb
365
- - spec/integration/association/one_to_many/custom_fks_spec.rb
366
- - spec/integration/association/one_to_many/from_view_spec.rb
367
- - spec/integration/association/one_to_many/self_ref_spec.rb
368
- - spec/integration/association/one_to_many_spec.rb
369
- - spec/integration/association/one_to_one_spec.rb
370
- - spec/integration/association/one_to_one_through_spec.rb
354
+ - spec/integration/associations/many_to_many/custom_fks_spec.rb
355
+ - spec/integration/associations/many_to_many/from_view_spec.rb
356
+ - spec/integration/associations/many_to_many_spec.rb
357
+ - spec/integration/associations/many_to_one/custom_fks_spec.rb
358
+ - spec/integration/associations/many_to_one/from_view_spec.rb
359
+ - spec/integration/associations/many_to_one/self_ref_spec.rb
360
+ - spec/integration/associations/many_to_one_spec.rb
361
+ - spec/integration/associations/one_to_many/custom_fks_spec.rb
362
+ - spec/integration/associations/one_to_many/from_view_spec.rb
363
+ - spec/integration/associations/one_to_many/self_ref_spec.rb
364
+ - spec/integration/associations/one_to_many_spec.rb
365
+ - spec/integration/associations/one_to_one_spec.rb
366
+ - spec/integration/associations/one_to_one_through_spec.rb
367
+ - spec/integration/auto_migrations/errors_spec.rb
368
+ - spec/integration/auto_migrations/indexes_spec.rb
369
+ - spec/integration/auto_migrations/managing_columns_spec.rb
370
+ - spec/integration/auto_migrations/postgres/column_types_spec.rb
371
371
  - spec/integration/commands/create_spec.rb
372
372
  - spec/integration/commands/delete_spec.rb
373
373
  - spec/integration/commands/update_spec.rb
@@ -378,7 +378,6 @@ test_files:
378
378
  - spec/integration/plugins/associates/many_to_many_spec.rb
379
379
  - spec/integration/plugins/associates_spec.rb
380
380
  - spec/integration/plugins/auto_restrictions_spec.rb
381
- - spec/integration/plugins/auto_wrap_spec.rb
382
381
  - spec/integration/relation_schema_spec.rb
383
382
  - spec/integration/schema/call_spec.rb
384
383
  - spec/integration/schema/inferrer/mysql_spec.rb
@@ -393,6 +392,7 @@ test_files:
393
392
  - spec/integration/setup_spec.rb
394
393
  - spec/integration/support/active_support_notifications_spec.rb
395
394
  - spec/integration/support/rails_log_subscriber_spec.rb
395
+ - spec/integration/wrap_spec.rb
396
396
  - spec/shared/accounts.rb
397
397
  - spec/shared/database_setup.rb
398
398
  - spec/shared/notes.rb
@@ -406,12 +406,7 @@ test_files:
406
406
  - spec/support/helpers.rb
407
407
  - spec/support/oracle/create_users.sql
408
408
  - spec/support/oracle/set_sys_passwords.sql
409
- - spec/unit/association/many_to_many_spec.rb
410
- - spec/unit/association/many_to_one_spec.rb
411
- - spec/unit/association/name_spec.rb
412
- - spec/unit/association/one_to_many_spec.rb
413
- - spec/unit/association/one_to_one_spec.rb
414
- - spec/unit/association/one_to_one_through_spec.rb
409
+ - spec/support/test_configuration.rb
415
410
  - spec/unit/attribute_spec.rb
416
411
  - spec/unit/function_spec.rb
417
412
  - spec/unit/gateway_spec.rb