commit 07e9a85c84e32c7e0a8e7869396a7a529bbd6bbd parent bd6d5f675d5794f069464b1cfc78d56623512ce4 Author: Jacob R. Edwards <jacob@jacobedwards.org> Date: Wed, 7 Aug 2024 16:35:51 -0700 Ensure floorplan names are of non-zero length This means simply adding a database check constraint. The one possible zero-length name before get's renamed to the hopefully unused 'This was an empty name'. Diffstat:
| A | cmd/api/migration/2024-08-07T22:35:44.sql | | | 4 | ++++ |
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/cmd/api/migration/2024-08-07T22:35:44.sql b/cmd/api/migration/2024-08-07T22:35:44.sql @@ -0,0 +1,4 @@ +# Hopefully 'This was an empty name' isn't already a floorplan name +UPDATE spaceplanner.floorplans SET name = 'This was an empty name' WHERE LENGTH(name) = 0 ; + +ALTER TABLE spaceplanner.floorplans ADD CONSTRAINT non_zero_name CHECK (LENGTH(name) > 0) ;