Files
smoa/backend/src/main/resources/db/migration/V1__baseline.sql
defiQUG 5a8c26cf5d Backend, sync, infra, docs: ETag, API versioning, k8s, web scaffold, Android 16, domain stubs
- Backend: ShallowEtagHeaderFilter for /api/v1/*, API-VERSIONING.md, README (tenant, CORS, Flyway, ETag)
- k8s: backend-deployment.yaml (Deployment, Service, Secret/ConfigMap)
- Web: scaffold with directory pull, 304 handling, touch-friendly UI
- Android 16: ANDROID-16-TARGET.md; BuildConfig STUN/signaling, SMOAApplication configures InfrastructureManager
- Domain: CertificateManager revocation stub, ReportService signReports, ZeroTrust/ThreatDetection minimal docs
- TODO.md and IMPLEMENTATION_STATUS.md updated; communications README for endpoint config

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-10 20:37:01 -08:00

83 lines
2.5 KiB
SQL

-- SMOA Backend baseline schema (H2 and PostgreSQL compatible)
-- For existing DBs created with ddl-auto: update, run: flyway baseline -baselineVersion=1
CREATE TABLE IF NOT EXISTS directory_entries (
id VARCHAR(255) NOT NULL PRIMARY KEY,
name VARCHAR(255) NOT NULL,
title VARCHAR(255),
unit VARCHAR(255) NOT NULL,
phone_number VARCHAR(255),
extension VARCHAR(255),
email VARCHAR(255),
secure_routing_id VARCHAR(255),
role VARCHAR(255),
clearance_level VARCHAR(255),
last_updated BIGINT NOT NULL
);
CREATE TABLE IF NOT EXISTS orders (
order_id VARCHAR(255) NOT NULL PRIMARY KEY,
order_type VARCHAR(255) NOT NULL,
title VARCHAR(255) NOT NULL,
content CLOB NOT NULL,
issued_by VARCHAR(255) NOT NULL,
issued_to VARCHAR(255),
issue_date TIMESTAMP NOT NULL,
effective_date TIMESTAMP NOT NULL,
expiration_date TIMESTAMP,
status VARCHAR(255) NOT NULL,
classification VARCHAR(255),
jurisdiction VARCHAR(255),
case_number VARCHAR(255),
updated_at BIGINT NOT NULL
);
CREATE TABLE IF NOT EXISTS evidence (
evidence_id VARCHAR(255) NOT NULL PRIMARY KEY,
case_number VARCHAR(255) NOT NULL,
description CLOB NOT NULL,
evidence_type VARCHAR(255) NOT NULL,
collection_date TIMESTAMP NOT NULL,
collection_location VARCHAR(255) NOT NULL,
collection_method VARCHAR(255) NOT NULL,
collected_by VARCHAR(255) NOT NULL,
current_custodian VARCHAR(255) NOT NULL,
storage_location VARCHAR(255),
updated_at BIGINT NOT NULL
);
CREATE TABLE IF NOT EXISTS credentials (
credential_id VARCHAR(255) NOT NULL PRIMARY KEY,
holder_id VARCHAR(255) NOT NULL,
credential_type VARCHAR(255) NOT NULL,
issuer VARCHAR(255),
issued_at BIGINT,
expires_at BIGINT,
payload_json CLOB,
updated_at BIGINT NOT NULL
);
CREATE TABLE IF NOT EXISTS reports (
report_id VARCHAR(255) NOT NULL PRIMARY KEY,
report_type VARCHAR(255) NOT NULL,
title VARCHAR(255) NOT NULL,
format VARCHAR(255),
generated_date BIGINT NOT NULL,
generated_by VARCHAR(255) NOT NULL,
content BLOB,
metadata_json CLOB,
updated_at BIGINT NOT NULL
);
CREATE TABLE IF NOT EXISTS sync_audit_log (
id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
resource_type VARCHAR(255) NOT NULL,
resource_id VARCHAR(255) NOT NULL,
operation VARCHAR(255) NOT NULL,
success BOOLEAN NOT NULL,
principal VARCHAR(255),
timestamp TIMESTAMP NOT NULL
);
CREATE INDEX IF NOT EXISTS idx_sync_audit_timestamp ON sync_audit_log(timestamp);