@@ -51,6 +59,14 @@
{space.building_location}
+ + diff --git a/supabase/migrations/20250609142130_add-compulsory-tags.sql b/supabase/migrations/20250609142130_add-compulsory-tags.sql index 5355520..485144c 100644 --- a/supabase/migrations/20250609142130_add-compulsory-tags.sql +++ b/supabase/migrations/20250609142130_add-compulsory-tags.sql @@ -2,9 +2,9 @@ alter table "public"."study_spaces" add column "power" text; alter table "public"."study_spaces" add column "volume" text; alter table "public"."study_spaces" add column "wifi" text; -update "public"."study_spaces" set "power" = 'Many' where "power" is null; +update "public"."study_spaces" set "power" = 'Many Outlets' where "power" is null; update "public"."study_spaces" set "volume" = 'Quiet' where "volume" is null; -update "public"."study_spaces" set "wifi" = 'Good' where "wifi" is null; +update "public"."study_spaces" set "wifi" = 'Good WiFi' where "wifi" is null; alter table "public"."study_spaces" alter column "power" set not null; alter table "public"."study_spaces" alter column "volume" set not null; diff --git a/supabase/migrations/20250610163930_add_report_table.sql b/supabase/migrations/20250610163930_add_report_table.sql new file mode 100644 index 0000000..0ac16d0 --- /dev/null +++ b/supabase/migrations/20250610163930_add_report_table.sql @@ -0,0 +1,12 @@ +CREATE TABLE reports ( + id uuid PRIMARY KEY DEFAULT gen_random_uuid(), + study_space_id uuid REFERENCES study_spaces(id) ON DELETE CASCADE, + created_at timestamp with time zone DEFAULT now(), + updated_at timestamp with time zone DEFAULT now(), + type text NOT NULL, + content text +); + +CREATE TRIGGER reports_updated_at +AFTER UPDATE ON reports +FOR EACH ROW EXECUTE FUNCTION handle_updated_at(); diff --git a/supabase/schemas/0001_study_spaces.sql b/supabase/schemas/0001_study_spaces.sql index 9d97101..5269ceb 100644 --- a/supabase/schemas/0001_study_spaces.sql +++ b/supabase/schemas/0001_study_spaces.sql @@ -28,6 +28,14 @@ CREATE TABLE study_space_images ( PRIMARY KEY (study_space_id, image_path) ); +CREATE TABLE reports ( + id uuid PRIMARY KEY DEFAULT gen_random_uuid(), + study_space_id uuid REFERENCES study_spaces(id) ON DELETE CASCADE, + created_at timestamp with time zone DEFAULT now(), + updated_at timestamp with time zone DEFAULT now(), + type text NOT NULL, + content text +); -- Triggers CREATE TRIGGER study_spaces_updated_at @@ -37,3 +45,7 @@ FOR EACH ROW EXECUTE FUNCTION handle_updated_at(); CREATE TRIGGER study_space_images_updated_at AFTER UPDATE ON study_space_images FOR EACH ROW EXECUTE FUNCTION handle_updated_at(); + +CREATE TRIGGER reports_updated_at +AFTER UPDATE ON reports +FOR EACH ROW EXECUTE FUNCTION handle_updated_at();