About and database table to convert for the orm

This commit is contained in:
gom-by
2025-01-14 13:49:04 +01:00
parent 0c0e5f80b9
commit 24e3272ab5
8 changed files with 94 additions and 4 deletions

View File

@@ -0,0 +1,11 @@
CREATE EXTENSION IF NOT EXISTS pgcrypto;
CREATE TYPE Event_status as ENUM('Canceled', 'Active')
CREATE TABLE events (
event_id UUID PRIMARY KEY, -- Use UUID as the primary key
creation_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP, -- Automatically capture the creation date
schedule_start DATE NOT NULL,
schedule_end DATE NOT NULL,
status Event_status DEFAULT 'Active', -- enum-like constraint for status
CHECK (schedule_start < schedule_end) -- Ensure the start date is before the end date
);