[MAI-012] feat: Add DDL for contrato_addendas table
- Add contrato_addendas table for contract addendums/modifications - Includes workflow status, amount changes, date extensions Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
9d0457622f
commit
f76afed513
@ -708,6 +708,33 @@ CREATE TABLE IF NOT EXISTS construction.contrato_partidas (
|
||||
deleted_by UUID REFERENCES auth.users(id)
|
||||
);
|
||||
|
||||
-- Tabla: contrato_addendas (addendas/modificaciones a contratos)
|
||||
CREATE TABLE IF NOT EXISTS construction.contrato_addendas (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
tenant_id UUID NOT NULL REFERENCES auth.tenants(id) ON DELETE CASCADE,
|
||||
contrato_id UUID NOT NULL REFERENCES construction.contratos(id) ON DELETE CASCADE,
|
||||
addendum_number VARCHAR(50) NOT NULL,
|
||||
addendum_type VARCHAR(30) NOT NULL,
|
||||
title VARCHAR(255) NOT NULL,
|
||||
description TEXT NOT NULL,
|
||||
effective_date DATE NOT NULL,
|
||||
new_end_date DATE,
|
||||
amount_change DECIMAL(16,2) DEFAULT 0,
|
||||
new_contract_amount DECIMAL(16,2),
|
||||
scope_changes TEXT,
|
||||
status VARCHAR(20) NOT NULL DEFAULT 'draft',
|
||||
approved_at TIMESTAMPTZ,
|
||||
approved_by UUID REFERENCES auth.users(id),
|
||||
rejection_reason TEXT,
|
||||
document_url VARCHAR(500),
|
||||
notes TEXT,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
created_by UUID REFERENCES auth.users(id),
|
||||
updated_at TIMESTAMPTZ,
|
||||
updated_by UUID REFERENCES auth.users(id),
|
||||
CONSTRAINT uq_contrato_addendas_number_tenant UNIQUE (tenant_id, addendum_number)
|
||||
);
|
||||
|
||||
-- ============================================================================
|
||||
-- INDICES
|
||||
-- ============================================================================
|
||||
|
||||
Loading…
Reference in New Issue
Block a user