feat(db): non-empty CHECK constraints on object text columns
This commit is contained in:
@@ -1,16 +1,17 @@
|
||||
-- Catalogue objects (the inventory-minimum core). One row = one object or a group.
|
||||
CREATE TABLE object (
|
||||
id UUID PRIMARY KEY,
|
||||
object_number TEXT NOT NULL UNIQUE,
|
||||
object_name TEXT NOT NULL,
|
||||
object_number TEXT NOT NULL UNIQUE CHECK (object_number <> ''),
|
||||
object_name TEXT NOT NULL CHECK (object_name <> ''),
|
||||
number_of_objects INTEGER NOT NULL DEFAULT 1 CHECK (number_of_objects >= 1),
|
||||
brief_description TEXT,
|
||||
current_location TEXT,
|
||||
current_owner TEXT,
|
||||
recorder TEXT,
|
||||
brief_description TEXT CHECK (brief_description <> ''),
|
||||
current_location TEXT CHECK (current_location <> ''),
|
||||
current_owner TEXT CHECK (current_owner <> ''),
|
||||
recorder TEXT CHECK (recorder <> ''),
|
||||
recording_date DATE,
|
||||
visibility TEXT NOT NULL DEFAULT 'draft'
|
||||
CHECK (visibility IN ('draft', 'internal', 'public')),
|
||||
-- updated_at is maintained by the repository (set to now() on update).
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user