README.md in umbrellio-sequel-plugins-0.1.2 vs README.md in umbrellio-sequel-plugins-0.2.0

- old
+ new

@@ -15,26 +15,27 @@ $ bundle # Extensions -- CurrencyRates -- PGTools -- Slave -- Synchronize +- `CurrencyRates` +- `PGTools` +- `Slave` +- `Synchronize` +- `methods_in_migrations` # Plugins -- Duplicate -- GetColumnValue -- StoreAccessors -- Synchronize -- Upsert -- WithLock +- `Duplicate` +- `GetColumnValue` +- `StoreAccessors` +- `Synchronize` +- `Upsert` +- `WithLock` # Tools -- TimestampMigratorUndoExtension +- `TimestampMigratorUndoExtension` ## CurrencyRates Plugin for joining currency rates table to any other table and money exchange. @@ -119,10 +120,36 @@ # => BEGIN # => SELECT pg_try_advisory_xact_lock(3764656399) -- 'ruby-forever' # => COMMIT ``` +## Methods in Migrations + +Enable: `Sequel.extension(:methods_in_migrations)` + +Support for method definitions and invocations inside `Sequel.migration`. + +Example: + +```ruby +Sequel.extension(:methods_in_migrations) + +Sequel.migration do + # define + def get_data + # ...some code... + end + + # use + up { get_data } + down { get_data } + + # without extension: + # => NameError: undefined local variable or method `get_data' for #<Sequel::Postgres::Database> +end +``` + ## Duplicate Enable: `Sequel::Model.plugin :duplicate` Model plugin for creating a copies. @@ -178,17 +205,17 @@ **Important:** requires a `synchronize` extension described above. Same as `DB#synchronize_with` -Enable: +Enable: ```ruby DB.extension :synchronize Sequel::Model.plugin :synchronize ``` -Example: +Example: ```ruby user = User.first user.synchronize([:ruby, :forever]) { p "Hey, I'm in transaction!"; sleep 5 } ```