1.7 KiB
1.7 KiB
ADDED Requirements
Requirement: Define PostgreSQL tables with Drizzle ORM
The package SHALL export Drizzle ORM table definitions using pgTable from drizzle-orm/pg-core, with proper column types, constraints, and defaults targeting PostgreSQL.
Scenario: Table exports are available
- WHEN another package imports from
@workspace/schema - THEN all Drizzle table definitions SHALL be accessible as named exports
Scenario: Table uses standard column types
- WHEN a column is defined in a Drizzle table
- THEN it SHALL use a
drizzle-orm/pg-corecolumn type (e.g.,text(),integer(),timestamp(),uuid(),boolean())
Requirement: Define PostgreSQL enums
The package SHALL support PostgreSQL enum definitions using pgEnum from drizzle-orm/pg-core for constrained string fields.
Scenario: Enum is defined and exportable
- WHEN an enum is created with
pgEnum - THEN it SHALL be exportable and usable as a column type in table definitions
Requirement: Define table relations
The package SHALL define Drizzle relations (relations from drizzle-orm) between tables, supporting one-to-many, many-to-one, and many-to-many relationships.
Scenario: Relation links two tables
- WHEN a relation is defined between two tables
- THEN the related fields SHALL be queryable via Drizzle's relational query API
Requirement: All schemas are co-located
The package SHALL colocate Drizzle table definitions, enums, and relations within the same directory structure under src/drizzle/.
Scenario: Single import for database concerns
- WHEN a consumer needs database schema
- THEN it SHALL import from
@workspace/schemawithout accessing internal paths