-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Goal
Define the PostgreSQL schema and set up an Alembic migration pipeline for MVP entities (vendors, licenses, license_sessions, audit_logs).
Requirements
Functional
- Initialize Alembic for migration management.
- Create
vendorstable (id, email, password_hash, name, timestamps). - Create
licensestable (vendor_id, key, status, customer info, fingerprint, expiration, timestamps). - Create
license_sessionstable (license_id, session_token, timestamps, heartbeat tracking). - Create
audit_logstable (vendor_id, action, actor, target info, metadata, timestamps). - Implement Foreign Key constraints and appropriate indexes.
Technical
- ORM/Migrations: SQLAlchemy + Alembic 1.x.
- Database: PostgreSQL 15+.
- Primary Keys: Use UUIDs (
gen_random_uuid()). - Constraints: Foreign keys with
ON DELETE CASCADE, unique constraints on email and license keys, check constraint for license status enum (active,expired,revoked). - Indexes: High-cardinality columns and frequently queried fields.
Acceptance Criteria
- Initial migration creates all 4 tables with correct schema.
- Foreign keys, unique constraints, and check constraints are enforced by the DB.
- Migrations are reversible (downgrade/upgrade) and idempotent.
- Schema diagram or ERD documented in README.
Dependencies
Reactions are currently unavailable