Sha256: cc8ff8a60f38442c27b26bcd40e662647dfe768856d85970c0f197a2f035d4bc

Contents?: true

Size: 762 Bytes

Versions: 1

Compression:

Stored size: 762 Bytes

Contents

# frozen_string_literals: true

require "jobshop/helpers/migration.rb"

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

  def change
    create_table :jobshop_mailmen, id: false do |t|
      t.uuid :organization_id, null: false
      t.citext :address, null: false
      t.index %i[ organization_id address ], unique: true,
        name: :idx_jobshop_mailmen_pkey

      t.string :handler_type, null: false

      t.timestamps
    end

    execute <<~SQL
      ALTER TABLE jobshop_mailmen
        ADD CONSTRAINT valid_handler_type
          CHECK (handler_type IN (
            'Jobshop::Mailroom::RFQHandler'
          ))
    SQL

    idx_table_name_pkey :jobshop_mailmen
    fk_organization :jobshop_mailmen
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jobshop-0.0.167 db/migrate/20181118014603_create_mailmen.rb