Sha256: 352f0016eb72f88b293a21659266bd1f2473152b5d613dd68e851e3d847fe7dc

Contents?: true

Size: 1.04 KB

Versions: 56

Compression:

Stored size: 1.04 KB

Contents

class CreateMartyEvents < ActiveRecord::Migration
  def change(*args)
    # Giant hack to monkey patch connection so that we can create an
    # UNLOGGED table in PostgreSQL.
    class << @connection
      alias_method :old_execute, :execute
      define_method(:execute) { |sql, name=nil|
        old_execute(sql.sub('CREATE', 'CREATE UNLOGGED'), name)
      }
    end
    create_table :marty_events do |t|
      t.integer  :promise_id, null: true
      t.string   :klass, null: false, limit: 255
      t.integer  :subject_id, null: false
      t.pg_enum  :enum_event_operation, null: false
      t.datetime :start_dt, null: true
      t.datetime :end_dt, null: true
      t.integer  :expire_secs, null: true
      t.string   :comment, null: true
    end
    class << @connection
      alias_method :execute, :old_execute
    end
    add_index :marty_events, [:klass, :subject_id,
                             :enum_event_operation],
              name: 'idx_klass_id_op'
    add_index :marty_events, [:klass, :subject_id],
              name: 'idx_klass_id'
  end
end

Version data entries

56 entries across 56 versions & 1 rubygems

Version Path
marty-1.2.9 db/migrate/201_create_marty_events.rb
marty-1.2.8 db/migrate/201_create_marty_events.rb
marty-1.2.7 db/migrate/201_create_marty_events.rb
marty-1.2.6 db/migrate/201_create_marty_events.rb
marty-1.2.5 db/migrate/201_create_marty_events.rb
marty-1.2.4 db/migrate/201_create_marty_events.rb
marty-1.2.3 db/migrate/201_create_marty_events.rb
marty-1.2.2 db/migrate/201_create_marty_events.rb
marty-1.2.1 db/migrate/201_create_marty_events.rb
marty-1.2.0 db/migrate/201_create_marty_events.rb
marty-1.1.9 db/migrate/201_create_marty_events.rb
marty-1.1.8 db/migrate/201_create_marty_events.rb
marty-1.1.7 db/migrate/201_create_marty_events.rb
marty-1.1.6 db/migrate/201_create_marty_events.rb
marty-1.1.5 db/migrate/201_create_marty_events.rb
marty-1.1.4 db/migrate/201_create_marty_events.rb
marty-1.1.3 db/migrate/201_create_marty_events.rb
marty-1.1.2 db/migrate/201_create_marty_events.rb
marty-1.1.1 db/migrate/201_create_marty_events.rb
marty-1.0.54 db/migrate/201_create_marty_events.rb