lib/rom/sql/extensions/postgres/commands.rb in rom-sql-3.4.0 vs lib/rom/sql/extensions/postgres/commands.rb in rom-sql-3.5.0
- old
+ new
@@ -83,20 +83,24 @@
#
# @api public
class Upsert < SQL::Commands::Create
adapter :sql
- defines :constraint, :conflict_target, :update_statement, :update_where
+ defines :constraint, :conflict_target, :conflict_where, :update_statement, :update_where
# @!attribute [r] constraint
# @return [Symbol] the name of the constraint expected to be violated
option :constraint, default: -> { self.class.constraint }
# @!attribute [r] conflict_target
# @return [Object] the column or expression to handle a violation on
option :conflict_target, default: -> { self.class.conflict_target }
+ # @!attribute [r] conflict_where
+ # @return [Object] the index filter, when using a partial index to determine uniqueness
+ option :conflict_where, default: -> { self.class.conflict_where }
+
# @!attribute [r] update_statement
# @return [Object] the update statement which will be executed in case of a violation
option :update_statement, default: -> { self.class.update_statement }
# @!attribute [r] update_where
@@ -121,9 +125,10 @@
# @api private
def upsert_options
@upsert_options ||= {
constraint: constraint,
target: conflict_target,
+ conflict_where: conflict_where,
update_where: update_where,
update: update_statement
}
end
end