17 lines
733 B
SQL
17 lines
733 B
SQL
-- Add has_balloon and balloon_day_id columns to trips table
|
|
-- This stores balloon state at trip level instead of checking trip_places
|
|
|
|
ALTER TABLE trips
|
|
ADD COLUMN has_balloon BOOLEAN DEFAULT false,
|
|
ADD COLUMN balloon_day_id UUID NULL;
|
|
|
|
-- Add foreign key constraint for balloon_day_id
|
|
ALTER TABLE trips
|
|
ADD CONSTRAINT fk_balloon_day
|
|
FOREIGN KEY (balloon_day_id) REFERENCES trip_days(id) ON DELETE SET NULL;
|
|
|
|
-- Add index for performance
|
|
CREATE INDEX idx_trips_has_balloon ON trips(has_balloon) WHERE has_balloon = true;
|
|
|
|
COMMENT ON COLUMN trips.has_balloon IS 'Indicates if this trip has a balloon flight activity';
|
|
COMMENT ON COLUMN trips.balloon_day_id IS 'The day_id where balloon flight is scheduled (if has_balloon is true)'; |