Class: CreateOutboxableOutboxes

Inherits:
Object
  • Object
show all
Defined in:
lib/templates/create_outboxable_outboxes.rb

Instance Method Summary collapse

Instance Method Details

#changeObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/templates/create_outboxable_outboxes.rb', line 2

def change
  enable_extension 'pgcrypto' unless extension_enabled?('pgcrypto')

  create_table :outboxes, id: :uuid, default: 'gen_random_uuid()' do |t|
    t.integer :status, null: false, default: 0

    t.string :exchange, null: false, default: ''
    t.string :routing_key, null: false, default: ''

    t.integer  :attempts, null: false, default: 0
    t.datetime :last_attempted_at, null: true
    t.datetime :retry_at, null: true

    t.jsonb :payload, default: {}
    t.jsonb :headers, default: {}

    t.integer :size, null: false, default: 0

    t.references :outboxable, polymorphic: true, null: true

    t.timestamps
  end
end