- Added views for listing fixed-price agreements, displaying agreement details, and a reporting dashboard. - Created HTML templates for listing, detailing, and reporting on fixed-price agreements. - Introduced API endpoint to fetch active customers for agreement creation. - Added migration scripts for creating necessary database tables and views for fixed-price agreements, billing periods, and reporting. - Implemented triggers for auto-generating agreement numbers and updating timestamps. - Enhanced ticket management with archived ticket views and filtering capabilities.
18 lines
592 B
SQL
18 lines
592 B
SQL
-- Migration: Add rounding interval to prepaid cards
|
|
|
|
ALTER TABLE tticket_prepaid_cards
|
|
ADD COLUMN IF NOT EXISTS rounding_minutes INTEGER DEFAULT 0;
|
|
|
|
DO $$
|
|
BEGIN
|
|
IF NOT EXISTS (
|
|
SELECT 1 FROM pg_constraint WHERE conname = 'chk_tticket_prepaid_rounding_minutes'
|
|
) THEN
|
|
ALTER TABLE tticket_prepaid_cards
|
|
ADD CONSTRAINT chk_tticket_prepaid_rounding_minutes
|
|
CHECK (rounding_minutes IN (0, 15, 30, 60));
|
|
END IF;
|
|
END $$;
|
|
|
|
COMMENT ON COLUMN tticket_prepaid_cards.rounding_minutes IS 'Round up prepaid usage to this interval in minutes (0 = no rounding)';
|