23 lines
963 B
MySQL
23 lines
963 B
MySQL
|
|
-- Migration 101: Add fixed_price_agreement_id to time tracking tables
|
||
|
|
-- Links time entries to fixed-price agreements for billing and reporting
|
||
|
|
|
||
|
|
-- Add to ticket worklog
|
||
|
|
ALTER TABLE tticket_worklog
|
||
|
|
ADD COLUMN IF NOT EXISTS fixed_price_agreement_id INTEGER
|
||
|
|
REFERENCES customer_fixed_price_agreements(id) ON DELETE SET NULL;
|
||
|
|
|
||
|
|
CREATE INDEX IF NOT EXISTS idx_worklog_fpa ON tticket_worklog(fixed_price_agreement_id);
|
||
|
|
|
||
|
|
-- Add to sag/solutions time tracking
|
||
|
|
ALTER TABLE tmodule_times
|
||
|
|
ADD COLUMN IF NOT EXISTS fixed_price_agreement_id INTEGER
|
||
|
|
REFERENCES customer_fixed_price_agreements(id) ON DELETE SET NULL;
|
||
|
|
|
||
|
|
CREATE INDEX IF NOT EXISTS idx_times_fpa ON tmodule_times(fixed_price_agreement_id);
|
||
|
|
|
||
|
|
COMMENT ON COLUMN tticket_worklog.fixed_price_agreement_id IS
|
||
|
|
'Links worklog entry to fixed-price agreement for billing tracking';
|
||
|
|
|
||
|
|
COMMENT ON COLUMN tmodule_times.fixed_price_agreement_id IS
|
||
|
|
'Links time entry to fixed-price agreement for billing tracking';
|