Missing unique constraint in preprod
A unique constraint is missing on the ImageServer table, making it possible to create servers with already existing URLs:
diff --git a/preprod b/prod
index e77026b..4f641e6 100644
--- a/preprod
+++ b/prod
@@ -1,22 +1,23 @@
Table "public.images_imageserver"
Column | Type | Collation | Nullable | Default
--------------+--------------------------+-----------+----------+------------------------------------------------
id | integer | | not null | nextval('images_imageserver_id_seq'::regclass)
display_name | character varying(250) | | not null |
url | character varying(200) | | not null |
created | timestamp with time zone | | not null |
updated | timestamp with time zone | | not null |
validated | boolean | | not null |
s3_bucket | character varying(63) | | |
read_only | boolean | | not null |
s3_region | character varying(63) | | |
max_height | integer | | |
max_width | integer | | |
Indexes:
"images_imageserver_pkey" PRIMARY KEY, btree (id)
+ "images_imageserver_url_e32640ce_uniq" UNIQUE CONSTRAINT, btree (url)
"images_imageserver_url_e32640ce_like" btree (url varchar_pattern_ops)
Check constraints:
"images_imageserver_max_height_check" CHECK (max_height >= 0)
"images_imageserver_max_width_check" CHECK (max_width >= 0)
Referenced by:
TABLE "images_image" CONSTRAINT "images_image_server_id_97d620d5_fk_images_imageserver_id" FOREIGN KEY (server_id) REFERENCES images_imageserver(id) DEFERRABLE INITIALLY DEFERRED
Creating a database from scratch and running all the migrations does create the unique constraint. This is only missing in preprod (and the preprod dumps), and not in prod.