fix: add unique constraint to columns that need it

This commit is contained in:
Alexis Fourmaux 2026-05-08 17:12:56 +02:00
parent 4ffb1e932d
commit 54f2a29c19

View file

@ -1,13 +1,13 @@
CREATE TABLE IF NOT EXISTS "device" (
"device_id" UUID NOT NULL DEFAULT uuidv4(),
"device_eui" VARCHAR(255) NOT NULL,
"device_eui" VARCHAR(255) NOT NULL UNIQUE,
"site_id" UUID,
PRIMARY KEY("device_id")
);
CREATE TABLE IF NOT EXISTS "site" (
"site_id" UUID NOT NULL DEFAULT uuidv4(),
"pce" VARCHAR(255) NOT NULL,
"pce" VARCHAR(255) NOT NULL UNIQUE,
"address_1" VARCHAR(255) NOT NULL,
"address_2" VARCHAR(255),
"postal_code" VARCHAR(255) NOT NULL,
@ -19,7 +19,7 @@ CREATE TABLE IF NOT EXISTS "user" (
"user_id" UUID NOT NULL DEFAULT uuidv4(),
"name" VARCHAR(255) NOT NULL,
"first_name" VARCHAR(255) NOT NULL,
"email" VARCHAR(255) NOT NULL,
"email" VARCHAR(255) NOT NULL UNIQUE,
"password_hash" VARCHAR(255),
"user_type_id" UUID NOT NULL,
PRIMARY KEY("user_id")