Sha256: 61d2ad9f024792ba42dd1069803c7634b92385ed49fda53160a3075dee0f135a

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

require "jobshop/helpers/migration.rb"

class CreateRFQs < ActiveRecord::Migration[5.2]
  include Jobshop::Helpers::Migration

  def change
    create_table :jobshop_rfqs, id: false do |t|
      t.uuid :organization_id, null: false
      t.uuid :rfq_id, null: false, default: "gen_random_uuid()"
      t.index %i[ organization_id rfq_id ], unique: true,
        name: "idx_jobshop_rfqs_pkey"

      t.uuid :company_id, null: true
      t.index %i[ organization_id company_id ], where: "company_id IS NOT NULL"
      t.index %i[ organization_id company_id ], where: "company_id IS NULL",
        name: "idx_jobshop_rfqs_company_is_null"

      t.string :from
      t.string :subject, null: false
      t.text :content, null: false

      t.timestamps
    end

    idx_table_name_pkey "jobshop_rfqs"
    fk_organization_id "jobshop_rfqs"
    foreign_key "jobshop_rfqs", "jobshop_companies",
      [ "organization_id", "company_id" ]

    create_table :jobshop_rfq_lines, id: false do |t|
      t.uuid :organization_id, null: false
      t.uuid :rfq_id, null: false
      t.uuid :rfq_line_id, null: false, default: "gen_random_uuid()"
      t.index %i[ organization_id rfq_id rfq_line_id ], unique: true,
        name: "idx_jobshop_rfq_lines_pkey"

      t.timestamps
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jobshop-0.0.163 db/migrate/20181117023949_create_rfqs.rb