Sha256: 054e729a2c7e8fb3d59f79fdb89f2f222740d9137e27b781afd7a3bd63c39df7

Contents?: true

Size: 1.38 KB

Versions: 1

Compression:

Stored size: 1.38 KB

Contents

# frozen_string_literals: true

require "jobshop/helpers/migration.rb"

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

  def change # rubocop:disable Metrics/MethodLength
    create_table :jobshop_people, id: false do |t|
      t.uuid :organization_id, null: false
      t.uuid :person_id, null: false, default: "gen_random_uuid()"
      t.index %i[ organization_id person_id ], unique: true,
        name: :idx_jobshop_people_pkey

      t.citext :email, null: false
      t.index %i[ organization_id email ], unique: true

      t.string :job_title
      t.string :forename
      t.string :surname

      t.timestamps
    end

    idx_table_name_pkey :jobshop_people
    fk_organization_id :jobshop_people

    create_table :jobshop_users, id: false do |t|
      t.uuid :organization_id, null: false
      t.uuid :user_id, null: false, default: "gen_random_uuid()"
      t.index %i[ organization_id user_id ], unique: true,
        name: :idx_jobshop_users_pkey

      t.citext :email, null: false
      t.index %i[ organization_id email ], unique: true

      t.string :email_authentication_token, index: { unique: true }
      t.datetime :email_authentication_token_sent_at, :datetime

      t.string :password_digest, null: false, default: ""

      t.timestamps
    end

    idx_table_name_pkey "jobshop_users"
    fk_organization_id "jobshop_users"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jobshop-0.0.163 db/migrate/20171216021554_create_people.rb