Sha256: af099adcdcf3b8a6d5cde742f3d225008412ad90d8f0a8e5fd4726a735e7bf72

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

class CreateApprovalTables < ActiveRecord::Migration[5.0]
  def change
    create_table :approval_requests do |t|
      t.integer  :request_user_id, null: false
      t.integer  :respond_user_id
      t.integer  :state,           null: false, limit: 1, default: 0
      t.datetime :requested_at,    null: false
      t.datetime :cancelled_at
      t.datetime :approved_at
      t.datetime :rejected_at

      t.timestamps

      t.index :request_user_id
      t.index :respond_user_id
      t.index :state
    end

    create_table :approval_items do |t|
      t.integer :request_id,    null: false
      t.integer :resource_id
      t.string  :resource_type, null: false
      t.string  :event,         null: false
      t.text    :params

      t.timestamps

      t.index :request_id
      t.index [:resource_id, :resource_type]
    end

    create_table :approval_comments do |t|
      t.integer :request_id, null: false
      t.integer :user_id,    null: false
      t.text    :content,    null: false

      t.timestamps

      t.index :request_id
      t.index :user_id
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
approval-0.3.7 db/migrate/20180409000000_create_approval_tables.rb