Database SQL Guidelines
=======================

This folder contains SQL assets for the TAF ERP project.

Files:
- `TAFDB.sql` (at repo root) holds **only** table definitions. Do not include data
  inserts here.
- `sql/defaults.sql` stores default production data such as statutory rates,
  system settings and the initial super admin account.
- `demoData/combined.sql` holds demo or sample data used for testing. No table
  definitions should appear there.

When adding or modifying tables:
- Use PostgreSQL's `SERIAL` or `GENERATED BY DEFAULT AS IDENTITY` for the `id`
  primary key column. Keep the name `id` and an integer type.
- Include an `UpdatedAt` `TIMESTAMP` column with `DEFAULT CURRENT_TIMESTAMP`.
- Use an `isDeleted` `BOOLEAN` (or `TINYINT` for databases without boolean
  support) defaulting to `FALSE` for soft deletes.
- Do **not** create foreign key constraints. Add indexes as needed.
- Modal definitions are stored in the `modules` table. The `config` column
  should use PostgreSQL's `jsonb` type for efficient storage and querying of the
  modal JSON payload.

Any schema changes must be reflected in `TAFDB.pgsql` 
