Files
hammer-queue/backend/init-todos.sql
Hammer fd823e2d75
All checks were successful
CI/CD / test (push) Successful in 16s
CI/CD / deploy (push) Successful in 2s
Add SQL init fallback for todos table creation
2026-01-30 04:59:17 +00:00

22 lines
673 B
SQL

-- Create todo_priority enum if not exists
DO $$ BEGIN
CREATE TYPE todo_priority AS ENUM ('high', 'medium', 'low', 'none');
EXCEPTION WHEN duplicate_object THEN null;
END $$;
-- Create todos table if not exists
CREATE TABLE IF NOT EXISTS todos (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
user_id TEXT NOT NULL,
title TEXT NOT NULL,
description TEXT,
is_completed BOOLEAN NOT NULL DEFAULT false,
priority todo_priority NOT NULL DEFAULT 'none',
category TEXT,
due_date TIMESTAMPTZ,
completed_at TIMESTAMPTZ,
sort_order INTEGER NOT NULL DEFAULT 0,
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
);