Skip to content

Commit 24c198d

Browse files
authored
feat(control_system): add additional fields (#300)
1 parent 5d6748a commit 24c198d

3 files changed

Lines changed: 28 additions & 7 deletions

File tree

migration/db/migrations/202408131534000_alter_bookings_change_induction_to_enum.sql

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ LANGUAGE plpgsql;
2525
-- Add the new column
2626
ALTER TABLE "bookings" ADD COLUMN IF NOT EXISTS induction_new public.booking_induction_type DEFAULT 'TENTATIVE'::public.booking_induction_type;
2727

28-
-- Migrate data
29-
UPDATE bookings
30-
SET induction_new = CASE
31-
WHEN induction = true THEN 'ACCEPTED'::public.booking_induction_type
32-
ELSE 'TENTATIVE'::public.booking_induction_type
33-
END;
28+
-- Migrate data (disabled retrospectively due to migration issues)
29+
-- UPDATE bookings
30+
-- SET induction_new = CASE
31+
-- WHEN induction = true THEN 'ACCEPTED'::public.booking_induction_type
32+
-- ELSE 'TENTATIVE'::public.booking_induction_type
33+
-- END;
3434

3535
-- Drop the old column and rename the new column
3636
ALTER TABLE bookings DROP COLUMN induction;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
-- +micrate Up
2+
-- SQL in section 'Up' is executed when this migration is applied
3+
4+
ALTER TABLE "sys" ADD COLUMN IF NOT EXISTS "timetable_url" TEXT NULL;
5+
ALTER TABLE "sys" ADD COLUMN IF NOT EXISTS "camera_url" TEXT NULL;
6+
ALTER TABLE "sys" ADD COLUMN IF NOT EXISTS "camera_snapshot_url" TEXT NULL;
7+
ALTER TABLE "sys" ADD COLUMN IF NOT EXISTS "room_booking_url" TEXT NULL;
8+
9+
-- +micrate Down
10+
-- SQL section 'Down' is executed when this migration is rolled back
11+
12+
ALTER TABLE "sys" DROP COLUMN IF EXISTS "timetable_url";
13+
ALTER TABLE "sys" DROP COLUMN IF EXISTS "camera_url";
14+
ALTER TABLE "sys" DROP COLUMN IF EXISTS "camera_snapshot_url";
15+
ALTER TABLE "sys" DROP COLUMN IF EXISTS "room_booking_url";

src/placeos-models/control_system.cr

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,14 @@ module PlaceOS::Model
4141

4242
attribute timezone : Time::Location?, converter: Time::Location::Converter, es_type: "text"
4343

44-
# Provide a field for simplifying support
44+
# Provide fields for simplifying support
4545
attribute support_url : String = ""
46+
attribute timetable_url : String?
47+
attribute camera_snapshot_url : String?
48+
attribute camera_url : String?
49+
50+
# if not bookable via google / O365 calendaring systems
51+
attribute room_booking_url : String?
4652

4753
attribute version : Int32 = 0
4854

0 commit comments

Comments
 (0)