17 lines
696 B
SQL
17 lines
696 B
SQL
-- Rodada 5, D4: a card already in Imprimindo changes machine, by Gestão or an
|
|
-- administrator with a reason; the part the new machine resumed from is kept
|
|
-- for the Revisor to check the tone seam.
|
|
CREATE TABLE IF NOT EXISTS dtf_local.machine_transfers (
|
|
id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
|
order_id uuid NOT NULL REFERENCES dtf_local.orders(id) ON DELETE CASCADE,
|
|
from_machine uuid,
|
|
to_machine uuid NOT NULL,
|
|
from_name text,
|
|
to_name text NOT NULL,
|
|
reason text NOT NULL,
|
|
resumed_from int,
|
|
created_by text NOT NULL,
|
|
created_at timestamptz NOT NULL DEFAULT now()
|
|
);
|
|
CREATE INDEX IF NOT EXISTS machine_transfers_order ON dtf_local.machine_transfers(order_id);
|