Foundation tables for the lessons module with full CRUD, pagination, search, and sorting. Includes migration, Drizzle schema, Zod validation, services, routes, and 23 integration tests.
27 lines
900 B
SQL
27 lines
900 B
SQL
-- Phase 1: Lessons foundation — instructor + lesson_type tables
|
|
|
|
CREATE TYPE "lesson_format" AS ENUM ('private', 'group');
|
|
|
|
CREATE TABLE "instructor" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
"user_id" uuid REFERENCES "user"("id"),
|
|
"display_name" varchar(255) NOT NULL,
|
|
"bio" text,
|
|
"instruments" text[],
|
|
"is_active" boolean NOT NULL DEFAULT true,
|
|
"created_at" timestamptz NOT NULL DEFAULT now(),
|
|
"updated_at" timestamptz NOT NULL DEFAULT now()
|
|
);
|
|
|
|
CREATE TABLE "lesson_type" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
"name" varchar(255) NOT NULL,
|
|
"instrument" varchar(100),
|
|
"duration_minutes" integer NOT NULL,
|
|
"lesson_format" lesson_format NOT NULL DEFAULT 'private',
|
|
"base_rate_monthly" varchar(20),
|
|
"is_active" boolean NOT NULL DEFAULT true,
|
|
"created_at" timestamptz NOT NULL DEFAULT now(),
|
|
"updated_at" timestamptz NOT NULL DEFAULT now()
|
|
);
|