Sha256: 31ec165abb7106f48e7a4d7f2dd7fa09f84149cfc9b0d53aed1086d2d88998a1
Contents?: true
Size: 903 Bytes
Versions: 4
Compression:
Stored size: 903 Bytes
Contents
class McFlyMigration < ActiveRecord::Migration INSERT_TRIG, UPDATE_TRIG, UPDATE_APPEND_ONLY_TRIG, DELETE_TRIG = %w{insert_trig update_trig update_append_only_trig delete_trig}.map { |f| File.read(File.dirname(__FILE__) + "/#{f}.sql") } TRIGS = [INSERT_TRIG, UPDATE_TRIG, DELETE_TRIG] def create_table(table_name, options = {}, &block) super { |t| t.integer :group_id, null: false # can't use created_at/updated_at as those are automatically # filled by ActiveRecord. t.timestamp :created_dt, null: false t.timestamp :obsoleted_dt, null: false t.references :user, null: false block.call(t) } self.class::TRIGS.each {|sql| execute sql % {table: table_name}} end end class McFlyAppendOnlyMigration < McFlyMigration # append-only update trigger disallows updates TRIGS = [INSERT_TRIG, UPDATE_APPEND_ONLY_TRIG, DELETE_TRIG] end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
mcfly-0.0.4 | lib/mcfly/migration.rb |
mcfly-0.0.3 | lib/mcfly/migration.rb |
mcfly-0.0.2 | lib/mcfly/migration.rb |
mcfly-0.0.1 | lib/mcfly/migration.rb |