Sha256: c6676c4e76eb79afc968e18889dcf8a58a0f70c900b402bff640e714d8514c14

Contents?: true

Size: 826 Bytes

Versions: 2

Compression:

Stored size: 826 Bytes

Contents

# frozen_string_literal: true

class CreateInitialModels < ActiveRecord::Migration[5.0]
  def change
    create_table :workflows do |t|
      t.string :name, null: false, unique: true
      t.jsonb :descriptor, null: false
    end

    add_index :workflows, :name, unique: true, name: 'workflows_name_unique_index'

    create_table :jobs do |t|
      t.jsonb :payload

      t.references :workflow, foreign_key: true

      t.timestamps
    end

    create_table :tasks do |t|
      t.string :name
      t.string :queue_name
      t.string :status
      t.column :locked_until, 'timestamp with time zone'
      t.string :locked_by
      t.jsonb :payload

      t.references :job, foreign_key: true
      t.references :parent_task, table_name: 'tasks', foreign_key: { to_table: 'tasks' }

      t.timestamps
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
qyu-store-activerecord-1.0.1 lib/qyu/store/activerecord/db/migrate/20170529131352_create_initial_models.rb
qyu-store-activerecord-1.0.0 lib/qyu/store/activerecord/db/migrate/20170529131352_create_initial_models.rb