c10fa98d0a
Restore original migrations (001-120) to fix schema_migrations version mismatch * Restore original migrations (001-120) to fix schema_migrations version mismatch The previous migration collapse broke deployed databases because: - Dev database was at version 120 (the real remove_text_extraction migration) - Main had collapsed migrations (001-012) + stub files (119_stub, 120_stub) - The migrate tool couldn't find version 119/120 with matching content This commit restores the original 27 migrations (versions 001-120) from before the collapse, ensuring backward compatibility with existing databases.
49 lines
1.3 KiB
SQL
49 lines
1.3 KiB
SQL
-- Create documentFieldExtractions table for single-value fields
|
|
CREATE TABLE documentFieldExtractions (
|
|
id uuid PRIMARY KEY DEFAULT uuid_generate_v7(),
|
|
documentId uuid NOT NULL,
|
|
|
|
-- Single-value fields (19 fields total - 1:1 relationship)
|
|
-- Document identification
|
|
fileName text,
|
|
contractTitle text,
|
|
aareteDerivedAmendmentNum int,
|
|
|
|
-- Party information
|
|
clientName text,
|
|
payerName text,
|
|
payerState text,
|
|
providerState text,
|
|
|
|
-- Tax identification numbers (stored as text to preserve leading zeros)
|
|
filenameTin text,
|
|
provGroupTin text,
|
|
provGroupNpi text,
|
|
provGroupNameFull text,
|
|
provOtherTin text,
|
|
provOtherNpi text,
|
|
provOtherNameFull text,
|
|
|
|
-- Contract dates
|
|
aareteDerivedEffectiveDt date,
|
|
aareteDerivedTerminationDt date,
|
|
|
|
-- Renewal information
|
|
autoRenewalInd boolean,
|
|
autoRenewalTerm text,
|
|
|
|
-- Metadata
|
|
createdAt timestamp NOT NULL DEFAULT NOW(),
|
|
createdBy varchar(255) NOT NULL,
|
|
|
|
FOREIGN KEY (documentId) REFERENCES documents(id)
|
|
);
|
|
|
|
-- Indexes for efficient queries
|
|
CREATE INDEX idx_documentfieldextractions_documentid
|
|
ON documentFieldExtractions(documentId);
|
|
CREATE INDEX idx_documentfieldextractions_createdby
|
|
ON documentFieldExtractions(createdBy);
|
|
CREATE INDEX idx_documentfieldextractions_filename
|
|
ON documentFieldExtractions(fileName);
|