Sha256: 75b889f4b9728c779e8131545c56c359a53a8a65a23482ffffa733a92460167c

Contents?: true

Size: 859 Bytes

Versions: 3

Compression:

Stored size: 859 Bytes

Contents

class <%= migration_class_name %> < ActiveRecord::Migration<%= migration_version %>
  def self.up
    create_table :kafka_messages, force: true do |t|
      t.string :topic, null: false
      t.binary :message, limit: 10.megabytes
      t.binary :key
      t.string :partition_key
      t.timestamps
    end

    add_index :kafka_messages, [:topic, :id]

    create_table :kafka_topic_info, force: true do |t|
      t.string :topic, null: false
      t.string :locked_by
      t.datetime :locked_at
      t.boolean :error, null: false, default: false
      t.integer :retries, null: false, default: 0
    end
    add_index :kafka_topic_info, :topic, unique: true
    add_index :kafka_topic_info, [:locked_by, :error]
    add_index :kafka_topic_info, :locked_at
  end

  def self.down
    drop_table :kafka_messages
    drop_table :kafka_topic_info
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
deimos-kafka-1.0.0.pre.beta17 lib/generators/deimos/db_backend/templates/rails3_migration
deimos-kafka-1.0.0.pre.beta16 lib/generators/deimos/db_backend/templates/rails3_migration
deimos-kafka-1.0.0.pre.beta15 lib/generators/deimos/db_backend/templates/rails3_migration