12 lines
515 B
SQL
12 lines
515 B
SQL
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
|
|
);
|