Sha256: 32c37ac3800db5e69aa18fed3d3fc7786775fe6e132c65e6eb16100982d767d2
Contents?: true
Size: 1.21 KB
Versions: 1
Compression:
Stored size: 1.21 KB
Contents
# frozen_string_literals: true require "jobshop/helpers/migration.rb" class CreateEmployees < ActiveRecord::Migration[5.2] include Jobshop::Helpers::Migration def change # rubocop:disable Metrics/MethodLength create_table_with_auditing :jobshop_employees, primary_key: %i[ organization_id employee_id ] do |t| t.citext :email, null: false t.string :forename t.string :surname t.timestamps end fk_organization :jobshop_employees create_table_with_auditing :jobshop_employments, primary_key: %i[ organization_id employment_id ] do |t| t.uuid :employee_id t.date :started_on, default: { expr: "('now'::text)::date" } t.date :ended_on t.string :title, null: false, default: "" t.datetime :updated_at, null: false t.uuid :updated_by_id t.datetime :deleted_at t.timestamps end fk_organization :jobshop_employments execute <<~SQL ALTER TABLE jobshop_employments ADD CONSTRAINT no_overlapping_employments EXCLUDE USING gist ( organization_id WITH =, employee_id WITH =, daterange(started_on, ended_on) WITH && ); SQL end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jobshop-0.0.167 | db/migrate/20171216021400_create_employees.rb |