commit 7e9b1b8ee44b3f9ef6269e7e00d6b91b25b209ab
parent e45829b5c07919c40b8dbf1159dd24f50bb61fb1
Author: Jacob R. Edwards <jacob@jacobedwards.org>
Date: Mon, 14 Oct 2024 10:10:33 -0700
Add window and railing pointmap types
While we're at it, make it much easier to change in the future by
making pointmaps type column reference the new pointmap_types table
which just contains the valid types (currently 'wall', 'door',
'window', and 'railing').
Diffstat:
1 file changed, 15 insertions(+), 0 deletions(-)
diff --git a/cmd/api/migration/2024-10-14T17:00:02.sql b/cmd/api/migration/2024-10-14T17:00:02.sql
@@ -0,0 +1,15 @@
+BEGIN;
+
+CREATE TABLE spaceplanner.pointmap_types (
+ name varchar PRIMARY KEY
+);
+
+INSERT INTO spaceplanner.pointmap_types (name)
+ VALUES ('wall'), ('door'), ('window'), ('railing');
+
+ALTER TABLE spaceplanner.floorplan_pointmaps
+ DROP CONSTRAINT valid_type;
+ALTER TABLE spaceplanner.floorplan_pointmaps
+ ADD CONSTRAINT pointmaps_type_fkey FOREIGN KEY (type) REFERENCES spaceplanner.pointmap_types(name);
+
+COMMIT;