lib/rom/sql/relation.rb in rom-sql-2.0.0.beta1 vs lib/rom/sql/relation.rb in rom-sql-2.0.0.beta2
- old
+ new
@@ -1,9 +1,10 @@
require 'rom/sql/types'
require 'rom/sql/schema'
require 'rom/sql/attribute'
require 'rom/sql/wrap'
+require 'rom/sql/transaction'
require 'rom/sql/relation/reading'
require 'rom/sql/relation/writing'
require 'rom/sql/relation/sequel_api'
@@ -22,10 +23,11 @@
extend Notifications::Listener
schema_class SQL::Schema
schema_attr_class SQL::Attribute
schema_inferrer ROM::SQL::Schema::Inferrer.new.freeze
+ schema_dsl SQL::Schema::DSL
wrap_class SQL::Wrap
subscribe('configuration.relations.schema.set', adapter: :sql) do |event|
schema = event[:schema]
relation = event[:relation]
@@ -109,9 +111,14 @@
# @return [Relation]
#
# @api public
def assoc(name)
associations[name].()
+ end
+
+ # @api public
+ def transaction(opts = EMPTY_HASH, &block)
+ Transaction.new(dataset.db).run(opts, &block)
end
# Return raw column names
#
# @return [Array<Symbol>]