Potion/internal/infrastructure/database/migrations/003_create_recipes_table.sql
Hayden Hargreaves b17c5774e9 (UI): Implemented much of the frontend recipe creation wizard.
Most everything is implemented, included a state handler and a pretty
simple (but workable) system for managing state in HTML. Nice and simple
for now.

There is still much work to be done, but the rest is simple backend
creation and error handling. And then input validation...a nightmare.
2025-06-29 22:30:20 -07:00

24 lines
695 B
PL/PgSQL

-- Author: Hayden Hargreaves (hhargreaves2006@gmail.com)
-- Desc: Create the recipes table in the database.
-- Date: 06/25/2025
BEGIN;
-- Create the recipes table
CREATE TABLE IF NOT EXISTS Recipes (
Id SERIAL PRIMARY KEY NOT NULL,
Title VARCHAR(128) NOT NULL,
Description TEXT NOT NULL,
Instructions VARCHAR(1024)[] NOT NULL,
Serves INTEGER NOT NULL CHECK (serves >= 0 AND serves <= 16),
Difficulty INTEGER NOT NULL CHECK (difficulty >= 1 AND difficulty <= 5),
Duration JSONB NOT NULL,
Category E_MEAL NOT NULL,
Ingredients JSONB NOT NULL,
UserId INTEGER NOT NULL REFERENCES users(id),
Modified TIMESTAMPTZ,
Created TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
COMMIT;