README.md in umbrellio-sequel-plugins-0.6.0.36 vs README.md in umbrellio-sequel-plugins-0.6.0.46

- old
+ new

@@ -21,10 +21,12 @@ - [`PGTools`](#PGTools) - [`Slave`](#Slave) - [`Synchronize`](#Synchronize) - [`Methods in Migrations`](#Methods-in-Migrations) - [`Deferrable Foreign Keys`](#Deferrable-Foreign-Keys) +- [`Set Local`](#Set-Local) +- [`Migration Transaction Options`](#Migration-Transaction-Options) # Plugins - [`AttrEncrypted`](#AttrEncrypted) - [`Duplicate`](#Duplicate) @@ -200,9 +202,50 @@ # without extension: # => Sequel::ForeignKeyConstraintViolation: Key (husband_id)=(123456789) is not present in table "husbands". # with extension: # => <Wife @attributes={id:1, husband_id: 1}> # => <Husband @attributes={id:1, wife_id: 1}> +``` + + +## Set Local + +Enable: `DB.extension(:set_local)` + +Makes possible to set transaction locals. + +Example: + +```ruby +DB.transaction(set_local: { lock_timeout: "5s", statement_timeout: "5s" }) {} +``` +```sql +BEGIN; +SET LOCAL lock_timeout = '5s'; +SET LOCAL statement_timeout = '5s'; +COMMIT; +``` + + +## Migration Transaction Options + +Enable: `Sequel.extension(:migration_transaction_options)` + +Makes possible to pass `transaction_options` in migrations. + +Example: + +```ruby +Sequel.migration do + transaction_options rollback: :always + + up { DB.select("1") } +end +``` +```sql +BEGIN; +SELECT '1'; +ROLLBACK; ``` ## AttrEncrypted Enable: `Sequel::Model.plugin :attr_encrypted`