# frozen_string_literals: true require "jobshop/helpers/migration.rb" class CreateRoutingProcesses < ActiveRecord::Migration[5.2] include Jobshop::Helpers::Migration def change # rubocop:disable Metrics/MethodLength create_table :jobshop_routing_processes, id: false do |t| t.uuid :organization_id, null: false t.uuid :routing_process_id, null: false, default: "gen_random_uuid()" t.index %i[ organization_id routing_process_id ], unique: true, name: "idx_jobshop_routing_processes_pkey" t.uuid :product_id t.index %i[ organization_id product_id ], unique: true, name: "idx_jobshop_routing_processes_product_id" end idx_table_name_pkey "jobshop_routing_processes" fk_organization_id "jobshop_routing_processes" foreign_key "jobshop_routing_processes", "jobshop_products", [ "organization_id", "product_id" ] create_table :jobshop_routing_process_instances, id: false do |t| t.uuid :organization_id, null: false t.uuid :routing_process_id, null: false t.uuid :routing_process_instance_id, null: false, default: "gen_random_uuid()" t.index %i[ organization_id routing_process_id routing_process_instance_id ], unique: true, name: "idx_jobshop_routing_process_instances_pkey" t.timestamps end idx_table_name_pkey "jobshop_routing_process_instances" fk_organization_id "jobshop_routing_process_instances" create_table :jobshop_routing_steps, id: false do |t| t.uuid :organization_id, null: false t.uuid :routing_step_id, null: false, default: "gen_random_uuid()" t.index %i[ organization_id routing_step_id ], unique: true, name: "idx_jobshop_routing_steps_pkey" t.uuid :routing_process_id, null: false t.index %i[ organization_id routing_process_id ], name: "idx_jobshop_routing_steps_routing_process_id" t.citext :name t.index %i[ organization_id name ] end idx_table_name_pkey "jobshop_routing_steps" fk_organization_id "jobshop_routing_steps" foreign_key "jobshop_routing_steps", "jobshop_routing_processes", [ "organization_id", "routing_process_id" ] create_table :jobshop_routing_process_events end end