asd
Tables (7)
drugs
- id — BIGSERIAL — Primary key — NOT NULL
- name — VARCHAR(100) — NOT NULL
- category — VARCHAR(50) — NOT NULL
- unit — VARCHAR(20) — NOT NULL
- created_at — TIMESTAMPTZ — NOT NULL
- updated_at — TIMESTAMPTZ — NOT NULL
lots
- id — BIGSERIAL — Primary key — NOT NULL
- ship_id — BIGINT — Foreign key → ships.id — NOT NULL
- drug_id — BIGINT — Foreign key → drugs.id — NOT NULL
- lot_number — VARCHAR(50) — NOT NULL
- received_quantity — INTEGER — NOT NULL
- remaining_quantity — INTEGER — NOT NULL
- expiry_date — DATE — NOT NULL
- received_at — TIMESTAMPTZ — NOT NULL
- created_at — TIMESTAMPTZ — NOT NULL
ships
- id — BIGSERIAL — Primary key — NOT NULL
- name — VARCHAR(100) — NOT NULL
- created_at — TIMESTAMPTZ — NOT NULL
stock_policies
- id — BIGSERIAL — Primary key — NOT NULL
- ship_id — BIGINT — Foreign key → ships.id — NOT NULL
- drug_id — BIGINT — Foreign key → drugs.id — NOT NULL
- min_quantity — INTEGER — NOT NULL
- created_at — TIMESTAMPTZ — NOT NULL
- updated_at — TIMESTAMPTZ — NOT NULL
usage_allocations
- id — BIGSERIAL — Primary key — NOT NULL
- usage_record_id — BIGINT — Foreign key → usage_records.id — NOT NULL
- lot_id — BIGINT — Foreign key → lots.id — NOT NULL
- allocated_quantity — INTEGER — NOT NULL
- created_at — TIMESTAMPTZ — NOT NULL
usage_records
- id — BIGSERIAL — Primary key — NOT NULL
- ship_id — BIGINT — Foreign key → ships.id — NOT NULL
- drug_id — BIGINT — Foreign key → drugs.id — NOT NULL
- total_quantity — INTEGER — NOT NULL
- status — VARCHAR(20) — NOT NULL
- used_by — BIGINT — Foreign key → users.id — NOT NULL
- used_at — TIMESTAMPTZ — NOT NULL
- cancelled_by — BIGINT — Foreign key → users.id
- cancelled_at — TIMESTAMPTZ
- created_at — TIMESTAMPTZ — NOT NULL
users
- id — BIGSERIAL — Primary key — NOT NULL
- user_key — VARCHAR(50) — NOT NULL
- created_at — TIMESTAMPTZ — NOT NULL