Data model for Lyric
npm install @overture-stack/lyric-data-model> [!NOTE]
> This package is likely not the one you want to use in your project, it is primarily used as a dependency within the Lyric monorepo. @overture-stack/lyric is what you are most likely to want to use.

- Documentation
- Migrations
- Scripts
- Drizzle Models
docs/ folder contains general documention about this project.
Describes the structure of the database illustrating how tables within the database are related to each other.
Check the latest diagram located at docs/schema.dbml
> Used DBML generator script to generate bellow file
A free database visualizer at dbdiagram.io
Illustrate the transitions of status on a lifecycle of a Submission
Check the latest diagram located at docs/stateDiagramSubmissionStatus.md
All migration files are provided under migrations/ folder.
- SQL Files
A list of .sql files are provided under migrations/ which contains SQL statements to apply directly to the database.
File names correspond to the sequential order in which it must be executed.
You can apply .sql files directly to the database or you can use the migration script.
- Drizzle Metadata and Journal
The meta/ folder contains the migrations history used by Drizzle.
A script dbmlGenerator.ts is provided to generate a DBML file based on the source schema files found at the folder src/models/.
To run this script use the command pnpm run build:dbml.
A script migrate.ts is provided as a helper to run SQL migration files on a specific database.
It executes all the .sql files found on migrations/ folder using Drizzle tools.
Database details are defined via environment variables. Use the variables found on file .env.schema as a template.
To run this script use the following command pnpm run db:migrate:dev.
Model files are located at src/models/.
Follow the SQL schema declarion on Drizzle oficial documentation to create schemas and check the PostgreSQL available column types.