Seeds include: - 01-core-catalogs.sql: Units, currencies, taxes, banks, states (~100 records) - 02-users-profiles.sql: 12 roles, 50+ permissions, 12 demo users - 03-empresa-tenant.sql: Demo company with 2 branches, 4 warehouses - 04-proyectos-obras.sql: 3 projects, stages, lots, apartments - 05-presupuestos.sql: CMIC-based concepts, 5 budgets - 06-estimaciones.sql: Contracts, estimates, advances - 07-avances-calidad.sql: Progress, logbook, quality checklists - 08-hse.sql: PPE catalog, training, incidents - 09-finanzas.sql: Chart of accounts, CxP, CxC, balanced entries - 10-activos-documentos.sql: Assets, maintenance, documents Total: ~940 records for complete demo coverage Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
418 lines
28 KiB
PL/PgSQL
418 lines
28 KiB
PL/PgSQL
-- ═══════════════════════════════════════════════════════════════════════════════
|
|
-- SEED 04: PROYECTOS Y OBRAS
|
|
-- ═══════════════════════════════════════════════════════════════════════════════
|
|
-- Proyecto: ERP Construcción
|
|
-- Autor: Claude Opus 4.5
|
|
-- Fecha: 2026-02-03
|
|
-- Descripción: Fraccionamientos, etapas, lotes, torres, departamentos, subcontratistas
|
|
-- Dependencias: 02-users-profiles.sql, 03-empresa-tenant.sql
|
|
-- ═══════════════════════════════════════════════════════════════════════════════
|
|
|
|
-- UUIDs determinísticos:
|
|
-- Prefijo: 00000000-0000-0000-0004-XXXXXXXXXXXX para proyectos/obras
|
|
|
|
-- Constantes
|
|
-- tenant_id: 00000000-0000-0000-0003-000000000001
|
|
|
|
BEGIN;
|
|
|
|
-- Variable para el tenant
|
|
DO $$
|
|
DECLARE
|
|
v_tenant_id UUID := '00000000-0000-0000-0003-000000000001';
|
|
v_admin_id UUID := '00000000-0000-0000-0002-000000000101';
|
|
v_gerente_id UUID := '00000000-0000-0000-0002-000000000103';
|
|
BEGIN
|
|
|
|
-- ─────────────────────────────────────────────────────────────────────────────────
|
|
-- 1. PROTOTIPOS DE VIVIENDA
|
|
-- ─────────────────────────────────────────────────────────────────────────────────
|
|
|
|
INSERT INTO construction.prototipos (
|
|
id, tenant_id, code, name, type,
|
|
area_construction_m2, area_terrain_m2,
|
|
bedrooms, bathrooms, parking_spaces, floors,
|
|
base_price, is_active, created_at, created_by
|
|
) VALUES
|
|
-- Horizontal - Casa tipo
|
|
('00000000-0000-0000-0004-000000000001', v_tenant_id,
|
|
'CASA-90', 'Casa Tipo 90', 'horizontal',
|
|
90.00, 120.00, 3, 2.5, 2, 2, 1850000.00, true, NOW(), v_admin_id),
|
|
|
|
('00000000-0000-0000-0004-000000000002', v_tenant_id,
|
|
'CASA-120', 'Casa Tipo 120', 'horizontal',
|
|
120.00, 150.00, 4, 3.0, 2, 2, 2450000.00, true, NOW(), v_admin_id),
|
|
|
|
('00000000-0000-0000-0004-000000000003', v_tenant_id,
|
|
'CASA-150', 'Casa Premium 150', 'horizontal',
|
|
150.00, 200.00, 4, 3.5, 3, 2, 3200000.00, true, NOW(), v_admin_id),
|
|
|
|
-- Vertical - Departamentos
|
|
('00000000-0000-0000-0004-000000000004', v_tenant_id,
|
|
'DEPTO-65', 'Departamento 65', 'vertical',
|
|
65.00, NULL, 2, 1.0, 1, 1, 1250000.00, true, NOW(), v_admin_id),
|
|
|
|
('00000000-0000-0000-0004-000000000005', v_tenant_id,
|
|
'DEPTO-85', 'Departamento 85', 'vertical',
|
|
85.00, NULL, 2, 2.0, 1, 1, 1650000.00, true, NOW(), v_admin_id),
|
|
|
|
('00000000-0000-0000-0004-000000000006', v_tenant_id,
|
|
'DEPTO-110', 'Departamento Premium 110', 'vertical',
|
|
110.00, NULL, 3, 2.0, 2, 1, 2150000.00, true, NOW(), v_admin_id)
|
|
ON CONFLICT (id) DO NOTHING;
|
|
|
|
-- ─────────────────────────────────────────────────────────────────────────────────
|
|
-- 2. FRACCIONAMIENTOS (PROYECTOS)
|
|
-- ─────────────────────────────────────────────────────────────────────────────────
|
|
|
|
INSERT INTO construction.fraccionamientos (
|
|
id, tenant_id, code, name, status,
|
|
project_type, total_lots, total_area_m2, buildable_area_m2,
|
|
address, city, state, zip_code,
|
|
start_date, estimated_end_date,
|
|
is_active, created_at, created_by
|
|
) VALUES
|
|
-- Proyecto 1: Horizontal - En construcción
|
|
('00000000-0000-0000-0004-000000000101', v_tenant_id,
|
|
'PALMAS-2024', 'Residencial Las Palmas', 'in_progress',
|
|
'horizontal', 120, 45000.00, 38000.00,
|
|
'Carr. Panamericana Norte Km 15', 'Aguascalientes', 'Aguascalientes', '20340',
|
|
'2024-03-01', '2026-12-31',
|
|
true, NOW(), v_gerente_id),
|
|
|
|
-- Proyecto 2: Vertical - En construcción
|
|
('00000000-0000-0000-0004-000000000102', v_tenant_id,
|
|
'DIAMANTE-2024', 'Torre Diamante', 'in_progress',
|
|
'vertical', 48, 8500.00, 6200.00,
|
|
'Blvd. A Zacatecas 1200, Centro', 'Aguascalientes', 'Aguascalientes', '20000',
|
|
'2024-06-01', '2027-06-30',
|
|
true, NOW(), v_gerente_id),
|
|
|
|
-- Proyecto 3: Comercial - En planeación
|
|
('00000000-0000-0000-0004-000000000103', v_tenant_id,
|
|
'PLAZA-2025', 'Plaza Central', 'planning',
|
|
'commercial', 24, 12000.00, 9500.00,
|
|
'Av. López Mateos 500', 'Aguascalientes', 'Aguascalientes', '20230',
|
|
'2025-01-15', '2026-06-30',
|
|
true, NOW(), v_gerente_id)
|
|
ON CONFLICT (id) DO NOTHING;
|
|
|
|
-- ─────────────────────────────────────────────────────────────────────────────────
|
|
-- 3. ETAPAS
|
|
-- ─────────────────────────────────────────────────────────────────────────────────
|
|
|
|
INSERT INTO construction.etapas (
|
|
id, tenant_id, fraccionamiento_id, code, name, sequence, status,
|
|
total_lots, start_date, end_date,
|
|
created_at, created_by
|
|
) VALUES
|
|
-- Las Palmas - 3 etapas
|
|
('00000000-0000-0000-0004-000000000201', v_tenant_id,
|
|
'00000000-0000-0000-0004-000000000101',
|
|
'PALMAS-E1', 'Etapa 1 - Norte', 1, 'in_progress',
|
|
40, '2024-03-01', '2025-06-30', NOW(), v_gerente_id),
|
|
|
|
('00000000-0000-0000-0004-000000000202', v_tenant_id,
|
|
'00000000-0000-0000-0004-000000000101',
|
|
'PALMAS-E2', 'Etapa 2 - Centro', 2, 'planning',
|
|
40, '2025-07-01', '2026-06-30', NOW(), v_gerente_id),
|
|
|
|
('00000000-0000-0000-0004-000000000203', v_tenant_id,
|
|
'00000000-0000-0000-0004-000000000101',
|
|
'PALMAS-E3', 'Etapa 3 - Sur', 3, 'draft',
|
|
40, '2026-07-01', '2026-12-31', NOW(), v_gerente_id),
|
|
|
|
-- Torre Diamante - 1 etapa (es una sola torre)
|
|
('00000000-0000-0000-0004-000000000204', v_tenant_id,
|
|
'00000000-0000-0000-0004-000000000102',
|
|
'DIAMANTE-E1', 'Torre Principal', 1, 'in_progress',
|
|
48, '2024-06-01', '2027-06-30', NOW(), v_gerente_id),
|
|
|
|
-- Plaza Central - 2 etapas
|
|
('00000000-0000-0000-0004-000000000205', v_tenant_id,
|
|
'00000000-0000-0000-0004-000000000103',
|
|
'PLAZA-E1', 'Fase 1 - Locales Ancla', 1, 'planning',
|
|
12, '2025-01-15', '2025-12-31', NOW(), v_gerente_id),
|
|
|
|
('00000000-0000-0000-0004-000000000206', v_tenant_id,
|
|
'00000000-0000-0000-0004-000000000103',
|
|
'PLAZA-E2', 'Fase 2 - Locales Menores', 2, 'draft',
|
|
12, '2026-01-01', '2026-06-30', NOW(), v_gerente_id)
|
|
ON CONFLICT (id) DO NOTHING;
|
|
|
|
-- ─────────────────────────────────────────────────────────────────────────────────
|
|
-- 4. MANZANAS (Para Las Palmas - Horizontal)
|
|
-- ─────────────────────────────────────────────────────────────────────────────────
|
|
|
|
INSERT INTO construction.manzanas (
|
|
id, tenant_id, etapa_id, code, name, total_lots,
|
|
created_at, created_by
|
|
) VALUES
|
|
-- Etapa 1 - 4 manzanas de 10 lotes cada una
|
|
('00000000-0000-0000-0004-000000000301', v_tenant_id,
|
|
'00000000-0000-0000-0004-000000000201',
|
|
'M1-A', 'Manzana A', 10, NOW(), v_gerente_id),
|
|
|
|
('00000000-0000-0000-0004-000000000302', v_tenant_id,
|
|
'00000000-0000-0000-0004-000000000201',
|
|
'M1-B', 'Manzana B', 10, NOW(), v_gerente_id),
|
|
|
|
('00000000-0000-0000-0004-000000000303', v_tenant_id,
|
|
'00000000-0000-0000-0004-000000000201',
|
|
'M1-C', 'Manzana C', 10, NOW(), v_gerente_id),
|
|
|
|
('00000000-0000-0000-0004-000000000304', v_tenant_id,
|
|
'00000000-0000-0000-0004-000000000201',
|
|
'M1-D', 'Manzana D', 10, NOW(), v_gerente_id),
|
|
|
|
-- Etapa 2 - 4 manzanas
|
|
('00000000-0000-0000-0004-000000000305', v_tenant_id,
|
|
'00000000-0000-0000-0004-000000000202',
|
|
'M2-A', 'Manzana A', 10, NOW(), v_gerente_id),
|
|
|
|
('00000000-0000-0000-0004-000000000306', v_tenant_id,
|
|
'00000000-0000-0000-0004-000000000202',
|
|
'M2-B', 'Manzana B', 10, NOW(), v_gerente_id),
|
|
|
|
('00000000-0000-0000-0004-000000000307', v_tenant_id,
|
|
'00000000-0000-0000-0004-000000000202',
|
|
'M2-C', 'Manzana C', 10, NOW(), v_gerente_id),
|
|
|
|
('00000000-0000-0000-0004-000000000308', v_tenant_id,
|
|
'00000000-0000-0000-0004-000000000202',
|
|
'M2-D', 'Manzana D', 10, NOW(), v_gerente_id)
|
|
ON CONFLICT (id) DO NOTHING;
|
|
|
|
-- ─────────────────────────────────────────────────────────────────────────────────
|
|
-- 5. TORRES (Para Torre Diamante - Vertical)
|
|
-- ─────────────────────────────────────────────────────────────────────────────────
|
|
|
|
INSERT INTO construction.torres (
|
|
id, tenant_id, etapa_id, code, name,
|
|
total_floors, total_units, status,
|
|
created_at, created_by
|
|
) VALUES
|
|
('00000000-0000-0000-0004-000000000401', v_tenant_id,
|
|
'00000000-0000-0000-0004-000000000204',
|
|
'TORRE-A', 'Torre A - Diamante', 12, 48, 'in_progress',
|
|
NOW(), v_gerente_id)
|
|
ON CONFLICT (id) DO NOTHING;
|
|
|
|
-- ─────────────────────────────────────────────────────────────────────────────────
|
|
-- 6. NIVELES (Pisos de la torre)
|
|
-- ─────────────────────────────────────────────────────────────────────────────────
|
|
|
|
INSERT INTO construction.niveles (
|
|
id, tenant_id, torre_id, floor_number, name, total_units,
|
|
created_at, created_by
|
|
) VALUES
|
|
('00000000-0000-0000-0004-000000000501', v_tenant_id, '00000000-0000-0000-0004-000000000401', 1, 'Planta Baja', 4, NOW(), v_gerente_id),
|
|
('00000000-0000-0000-0004-000000000502', v_tenant_id, '00000000-0000-0000-0004-000000000401', 2, 'Nivel 2', 4, NOW(), v_gerente_id),
|
|
('00000000-0000-0000-0004-000000000503', v_tenant_id, '00000000-0000-0000-0004-000000000401', 3, 'Nivel 3', 4, NOW(), v_gerente_id),
|
|
('00000000-0000-0000-0004-000000000504', v_tenant_id, '00000000-0000-0000-0004-000000000401', 4, 'Nivel 4', 4, NOW(), v_gerente_id),
|
|
('00000000-0000-0000-0004-000000000505', v_tenant_id, '00000000-0000-0000-0004-000000000401', 5, 'Nivel 5', 4, NOW(), v_gerente_id),
|
|
('00000000-0000-0000-0004-000000000506', v_tenant_id, '00000000-0000-0000-0004-000000000401', 6, 'Nivel 6', 4, NOW(), v_gerente_id),
|
|
('00000000-0000-0000-0004-000000000507', v_tenant_id, '00000000-0000-0000-0004-000000000401', 7, 'Nivel 7', 4, NOW(), v_gerente_id),
|
|
('00000000-0000-0000-0004-000000000508', v_tenant_id, '00000000-0000-0000-0004-000000000401', 8, 'Nivel 8', 4, NOW(), v_gerente_id),
|
|
('00000000-0000-0000-0004-000000000509', v_tenant_id, '00000000-0000-0000-0004-000000000401', 9, 'Nivel 9', 4, NOW(), v_gerente_id),
|
|
('00000000-0000-0000-0004-000000000510', v_tenant_id, '00000000-0000-0000-0004-000000000401', 10, 'Nivel 10', 4, NOW(), v_gerente_id),
|
|
('00000000-0000-0000-0004-000000000511', v_tenant_id, '00000000-0000-0000-0004-000000000401', 11, 'Nivel 11', 4, NOW(), v_gerente_id),
|
|
('00000000-0000-0000-0004-000000000512', v_tenant_id, '00000000-0000-0000-0004-000000000401', 12, 'Penthouse', 4, NOW(), v_gerente_id)
|
|
ON CONFLICT (id) DO NOTHING;
|
|
|
|
END $$;
|
|
|
|
-- ─────────────────────────────────────────────────────────────────────────────────
|
|
-- 7. LOTES (Manzana A - Etapa 1 - Las Palmas)
|
|
-- ─────────────────────────────────────────────────────────────────────────────────
|
|
|
|
INSERT INTO construction.lotes (
|
|
id, tenant_id, manzana_id, prototipo_id,
|
|
code, official_number, status,
|
|
area_m2, front_m, depth_m,
|
|
price_base, price_final,
|
|
created_at, created_by
|
|
) VALUES
|
|
-- Manzana A - 10 lotes
|
|
('00000000-0000-0000-0004-000000000601', '00000000-0000-0000-0003-000000000001', '00000000-0000-0000-0004-000000000301', '00000000-0000-0000-0004-000000000001',
|
|
'A-01', '1', 'delivered', 120.00, 8.00, 15.00, 1850000.00, 1900000.00, NOW(), '00000000-0000-0000-0002-000000000103'),
|
|
('00000000-0000-0000-0004-000000000602', '00000000-0000-0000-0003-000000000001', '00000000-0000-0000-0004-000000000301', '00000000-0000-0000-0004-000000000001',
|
|
'A-02', '2', 'delivered', 120.00, 8.00, 15.00, 1850000.00, 1900000.00, NOW(), '00000000-0000-0000-0002-000000000103'),
|
|
('00000000-0000-0000-0004-000000000603', '00000000-0000-0000-0003-000000000001', '00000000-0000-0000-0004-000000000301', '00000000-0000-0000-0004-000000000002',
|
|
'A-03', '3', 'under_construction', 150.00, 10.00, 15.00, 2450000.00, 2500000.00, NOW(), '00000000-0000-0000-0002-000000000103'),
|
|
('00000000-0000-0000-0004-000000000604', '00000000-0000-0000-0003-000000000001', '00000000-0000-0000-0004-000000000301', '00000000-0000-0000-0004-000000000002',
|
|
'A-04', '4', 'under_construction', 150.00, 10.00, 15.00, 2450000.00, 2500000.00, NOW(), '00000000-0000-0000-0002-000000000103'),
|
|
('00000000-0000-0000-0004-000000000605', '00000000-0000-0000-0003-000000000001', '00000000-0000-0000-0004-000000000301', '00000000-0000-0000-0004-000000000001',
|
|
'A-05', '5', 'sold', 120.00, 8.00, 15.00, 1850000.00, 1880000.00, NOW(), '00000000-0000-0000-0002-000000000103'),
|
|
('00000000-0000-0000-0004-000000000606', '00000000-0000-0000-0003-000000000001', '00000000-0000-0000-0004-000000000301', '00000000-0000-0000-0004-000000000001',
|
|
'A-06', '6', 'sold', 120.00, 8.00, 15.00, 1850000.00, 1880000.00, NOW(), '00000000-0000-0000-0002-000000000103'),
|
|
('00000000-0000-0000-0004-000000000607', '00000000-0000-0000-0003-000000000001', '00000000-0000-0000-0004-000000000301', '00000000-0000-0000-0004-000000000003',
|
|
'A-07', '7', 'reserved', 200.00, 12.50, 16.00, 3200000.00, 3300000.00, NOW(), '00000000-0000-0000-0002-000000000103'),
|
|
('00000000-0000-0000-0004-000000000608', '00000000-0000-0000-0003-000000000001', '00000000-0000-0000-0004-000000000301', '00000000-0000-0000-0004-000000000003',
|
|
'A-08', '8', 'available', 200.00, 12.50, 16.00, 3200000.00, 3300000.00, NOW(), '00000000-0000-0000-0002-000000000103'),
|
|
('00000000-0000-0000-0004-000000000609', '00000000-0000-0000-0003-000000000001', '00000000-0000-0000-0004-000000000301', '00000000-0000-0000-0004-000000000001',
|
|
'A-09', '9', 'available', 120.00, 8.00, 15.00, 1850000.00, 1850000.00, NOW(), '00000000-0000-0000-0002-000000000103'),
|
|
('00000000-0000-0000-0004-000000000610', '00000000-0000-0000-0003-000000000001', '00000000-0000-0000-0004-000000000301', '00000000-0000-0000-0004-000000000001',
|
|
'A-10', '10', 'available', 120.00, 8.00, 15.00, 1850000.00, 1850000.00, NOW(), '00000000-0000-0000-0002-000000000103'),
|
|
|
|
-- Manzana B - 10 lotes más
|
|
('00000000-0000-0000-0004-000000000611', '00000000-0000-0000-0003-000000000001', '00000000-0000-0000-0004-000000000302', '00000000-0000-0000-0004-000000000001',
|
|
'B-01', '11', 'under_construction', 120.00, 8.00, 15.00, 1850000.00, 1900000.00, NOW(), '00000000-0000-0000-0002-000000000103'),
|
|
('00000000-0000-0000-0004-000000000612', '00000000-0000-0000-0003-000000000001', '00000000-0000-0000-0004-000000000302', '00000000-0000-0000-0004-000000000001',
|
|
'B-02', '12', 'under_construction', 120.00, 8.00, 15.00, 1850000.00, 1900000.00, NOW(), '00000000-0000-0000-0002-000000000103'),
|
|
('00000000-0000-0000-0004-000000000613', '00000000-0000-0000-0003-000000000001', '00000000-0000-0000-0004-000000000302', '00000000-0000-0000-0004-000000000002',
|
|
'B-03', '13', 'sold', 150.00, 10.00, 15.00, 2450000.00, 2480000.00, NOW(), '00000000-0000-0000-0002-000000000103'),
|
|
('00000000-0000-0000-0004-000000000614', '00000000-0000-0000-0003-000000000001', '00000000-0000-0000-0004-000000000302', '00000000-0000-0000-0004-000000000002',
|
|
'B-04', '14', 'available', 150.00, 10.00, 15.00, 2450000.00, 2450000.00, NOW(), '00000000-0000-0000-0002-000000000103'),
|
|
('00000000-0000-0000-0004-000000000615', '00000000-0000-0000-0003-000000000001', '00000000-0000-0000-0004-000000000302', '00000000-0000-0000-0004-000000000001',
|
|
'B-05', '15', 'available', 120.00, 8.00, 15.00, 1850000.00, 1850000.00, NOW(), '00000000-0000-0000-0002-000000000103')
|
|
ON CONFLICT (id) DO NOTHING;
|
|
|
|
-- ─────────────────────────────────────────────────────────────────────────────────
|
|
-- 8. DEPARTAMENTOS (Torre Diamante - Primeros 4 niveles)
|
|
-- ─────────────────────────────────────────────────────────────────────────────────
|
|
|
|
INSERT INTO construction.departamentos (
|
|
id, tenant_id, nivel_id, prototipo_id,
|
|
code, unit_number, status,
|
|
area_m2, price_base, price_final,
|
|
created_at, created_by
|
|
) VALUES
|
|
-- Nivel 1 (Planta Baja) - 4 deptos
|
|
('00000000-0000-0000-0004-000000000701', '00000000-0000-0000-0003-000000000001', '00000000-0000-0000-0004-000000000501', '00000000-0000-0000-0004-000000000004',
|
|
'A-101', '101', 'delivered', 65.00, 1250000.00, 1300000.00, NOW(), '00000000-0000-0000-0002-000000000103'),
|
|
('00000000-0000-0000-0004-000000000702', '00000000-0000-0000-0003-000000000001', '00000000-0000-0000-0004-000000000501', '00000000-0000-0000-0004-000000000005',
|
|
'A-102', '102', 'delivered', 85.00, 1650000.00, 1700000.00, NOW(), '00000000-0000-0000-0002-000000000103'),
|
|
('00000000-0000-0000-0004-000000000703', '00000000-0000-0000-0003-000000000001', '00000000-0000-0000-0004-000000000501', '00000000-0000-0000-0004-000000000005',
|
|
'A-103', '103', 'sold', 85.00, 1650000.00, 1680000.00, NOW(), '00000000-0000-0000-0002-000000000103'),
|
|
('00000000-0000-0000-0004-000000000704', '00000000-0000-0000-0003-000000000001', '00000000-0000-0000-0004-000000000501', '00000000-0000-0000-0004-000000000004',
|
|
'A-104', '104', 'sold', 65.00, 1250000.00, 1280000.00, NOW(), '00000000-0000-0000-0002-000000000103'),
|
|
|
|
-- Nivel 2 - 4 deptos
|
|
('00000000-0000-0000-0004-000000000705', '00000000-0000-0000-0003-000000000001', '00000000-0000-0000-0004-000000000502', '00000000-0000-0000-0004-000000000004',
|
|
'A-201', '201', 'under_construction', 65.00, 1250000.00, 1320000.00, NOW(), '00000000-0000-0000-0002-000000000103'),
|
|
('00000000-0000-0000-0004-000000000706', '00000000-0000-0000-0003-000000000001', '00000000-0000-0000-0004-000000000502', '00000000-0000-0000-0004-000000000005',
|
|
'A-202', '202', 'under_construction', 85.00, 1650000.00, 1720000.00, NOW(), '00000000-0000-0000-0002-000000000103'),
|
|
('00000000-0000-0000-0004-000000000707', '00000000-0000-0000-0003-000000000001', '00000000-0000-0000-0004-000000000502', '00000000-0000-0000-0004-000000000005',
|
|
'A-203', '203', 'reserved', 85.00, 1650000.00, 1720000.00, NOW(), '00000000-0000-0000-0002-000000000103'),
|
|
('00000000-0000-0000-0004-000000000708', '00000000-0000-0000-0003-000000000001', '00000000-0000-0000-0004-000000000502', '00000000-0000-0000-0004-000000000004',
|
|
'A-204', '204', 'available', 65.00, 1250000.00, 1320000.00, NOW(), '00000000-0000-0000-0002-000000000103'),
|
|
|
|
-- Nivel 3 - 4 deptos
|
|
('00000000-0000-0000-0004-000000000709', '00000000-0000-0000-0003-000000000001', '00000000-0000-0000-0004-000000000503', '00000000-0000-0000-0004-000000000004',
|
|
'A-301', '301', 'available', 65.00, 1250000.00, 1340000.00, NOW(), '00000000-0000-0000-0002-000000000103'),
|
|
('00000000-0000-0000-0004-000000000710', '00000000-0000-0000-0003-000000000001', '00000000-0000-0000-0004-000000000503', '00000000-0000-0000-0004-000000000005',
|
|
'A-302', '302', 'available', 85.00, 1650000.00, 1740000.00, NOW(), '00000000-0000-0000-0002-000000000103'),
|
|
('00000000-0000-0000-0004-000000000711', '00000000-0000-0000-0003-000000000001', '00000000-0000-0000-0004-000000000503', '00000000-0000-0000-0004-000000000006',
|
|
'A-303', '303', 'available', 110.00, 2150000.00, 2250000.00, NOW(), '00000000-0000-0000-0002-000000000103'),
|
|
('00000000-0000-0000-0004-000000000712', '00000000-0000-0000-0003-000000000001', '00000000-0000-0000-0004-000000000503', '00000000-0000-0000-0004-000000000004',
|
|
'A-304', '304', 'available', 65.00, 1250000.00, 1340000.00, NOW(), '00000000-0000-0000-0002-000000000103')
|
|
ON CONFLICT (id) DO NOTHING;
|
|
|
|
-- ─────────────────────────────────────────────────────────────────────────────────
|
|
-- 9. SUBCONTRATISTAS
|
|
-- ─────────────────────────────────────────────────────────────────────────────────
|
|
|
|
INSERT INTO construction.subcontratistas (
|
|
id, tenant_id, code, name, legal_name, tax_id,
|
|
specialty, contact_name, contact_phone, contact_email,
|
|
rating, is_active, created_at, created_by
|
|
) VALUES
|
|
('00000000-0000-0000-0004-000000000801', '00000000-0000-0000-0003-000000000001',
|
|
'SUB-001', 'Cimientos del Norte', 'Cimientos del Norte S.A. de C.V.', 'CNO010101AAA',
|
|
'Cimentación y Estructuras', 'Roberto Fundación', '+52 449 111 1111', 'contacto@cimientosnorte.com',
|
|
4.5, true, NOW(), '00000000-0000-0000-0002-000000000103'),
|
|
|
|
('00000000-0000-0000-0004-000000000802', '00000000-0000-0000-0003-000000000001',
|
|
'SUB-002', 'Electrificaciones AGS', 'Electrificaciones AGS S.A. de C.V.', 'EAG010101BBB',
|
|
'Instalaciones Eléctricas', 'Luis Voltaje', '+52 449 222 2222', 'luis@electroags.com',
|
|
4.8, true, NOW(), '00000000-0000-0000-0002-000000000103'),
|
|
|
|
('00000000-0000-0000-0004-000000000803', '00000000-0000-0000-0003-000000000001',
|
|
'SUB-003', 'Plomería Integral', 'Plomería Integral de Aguascalientes S.A. de C.V.', 'PIA010101CCC',
|
|
'Instalaciones Hidráulicas y Sanitarias', 'Pedro Tubería', '+52 449 333 3333', 'pedro@plomeriaintegral.com',
|
|
4.2, true, NOW(), '00000000-0000-0000-0002-000000000103'),
|
|
|
|
('00000000-0000-0000-0004-000000000804', '00000000-0000-0000-0003-000000000001',
|
|
'SUB-004', 'Acabados Finos', 'Acabados Finos y Decoración S.A. de C.V.', 'AFD010101DDD',
|
|
'Acabados y Pintura', 'María Acabado', '+52 449 444 4444', 'maria@acabadosfinos.com',
|
|
4.6, true, NOW(), '00000000-0000-0000-0002-000000000103'),
|
|
|
|
('00000000-0000-0000-0004-000000000805', '00000000-0000-0000-0003-000000000001',
|
|
'SUB-005', 'Herrería Artística', 'Herrería y Cancelería Artística S.A. de C.V.', 'HCA010101EEE',
|
|
'Herrería y Cancelería', 'José Fierro', '+52 449 555 5555', 'jose@herreriaartistica.com',
|
|
4.3, true, NOW(), '00000000-0000-0000-0002-000000000103'),
|
|
|
|
('00000000-0000-0000-0004-000000000806', '00000000-0000-0000-0003-000000000001',
|
|
'SUB-006', 'Carpintería Moderna', 'Carpintería y Cocinas Modernas S.A. de C.V.', 'CCM010101FFF',
|
|
'Carpintería y Cocinas', 'Francisco Madera', '+52 449 666 6666', 'francisco@carpinteriamoderna.com',
|
|
4.7, true, NOW(), '00000000-0000-0000-0002-000000000103'),
|
|
|
|
('00000000-0000-0000-0004-000000000807', '00000000-0000-0000-0003-000000000001',
|
|
'SUB-007', 'Impermeabilizantes Pro', 'Impermeabilizaciones Profesionales S.A. de C.V.', 'IPR010101GGG',
|
|
'Impermeabilización', 'Carlos Impermeable', '+52 449 777 7777', 'carlos@imperpro.com',
|
|
4.4, true, NOW(), '00000000-0000-0000-0002-000000000103'),
|
|
|
|
('00000000-0000-0000-0004-000000000808', '00000000-0000-0000-0003-000000000001',
|
|
'SUB-008', 'Pisos y Azulejos', 'Pisos y Azulejos del Centro S.A. de C.V.', 'PAC010101HHH',
|
|
'Pisos y Recubrimientos', 'Ana Piso', '+52 449 888 8888', 'ana@pisosyazulejos.com',
|
|
4.5, true, NOW(), '00000000-0000-0000-0002-000000000103'),
|
|
|
|
('00000000-0000-0000-0004-000000000809', '00000000-0000-0000-0003-000000000001',
|
|
'SUB-009', 'Vidrios y Cristales', 'Vidrios y Cristalería Premium S.A. de C.V.', 'VCP010101III',
|
|
'Vidrio y Aluminio', 'Raúl Cristal', '+52 449 999 9999', 'raul@vidriospremium.com',
|
|
4.1, true, NOW(), '00000000-0000-0000-0002-000000000103'),
|
|
|
|
('00000000-0000-0000-0004-000000000810', '00000000-0000-0000-0003-000000000001',
|
|
'SUB-010', 'Jardinería Integral', 'Jardinería y Paisajismo Integral S.A. de C.V.', 'JPI010101JJJ',
|
|
'Jardinería y Áreas Verdes', 'Elena Verde', '+52 449 101 0101', 'elena@jardineriaintegral.com',
|
|
4.9, true, NOW(), '00000000-0000-0000-0002-000000000103')
|
|
ON CONFLICT (id) DO NOTHING;
|
|
|
|
-- ─────────────────────────────────────────────────────────────────────────────────
|
|
-- VERIFICACIÓN
|
|
-- ─────────────────────────────────────────────────────────────────────────────────
|
|
|
|
DO $$
|
|
DECLARE
|
|
v_prototipos INTEGER;
|
|
v_fraccionamientos INTEGER;
|
|
v_etapas INTEGER;
|
|
v_manzanas INTEGER;
|
|
v_torres INTEGER;
|
|
v_niveles INTEGER;
|
|
v_lotes INTEGER;
|
|
v_departamentos INTEGER;
|
|
v_subcontratistas INTEGER;
|
|
BEGIN
|
|
SELECT COUNT(*) INTO v_prototipos FROM construction.prototipos;
|
|
SELECT COUNT(*) INTO v_fraccionamientos FROM construction.fraccionamientos;
|
|
SELECT COUNT(*) INTO v_etapas FROM construction.etapas;
|
|
SELECT COUNT(*) INTO v_manzanas FROM construction.manzanas;
|
|
SELECT COUNT(*) INTO v_torres FROM construction.torres;
|
|
SELECT COUNT(*) INTO v_niveles FROM construction.niveles;
|
|
SELECT COUNT(*) INTO v_lotes FROM construction.lotes;
|
|
SELECT COUNT(*) INTO v_departamentos FROM construction.departamentos;
|
|
SELECT COUNT(*) INTO v_subcontratistas FROM construction.subcontratistas;
|
|
|
|
RAISE NOTICE '══════════════════════════════════════════════════════════════';
|
|
RAISE NOTICE 'SEED 04 - PROYECTOS Y OBRAS - COMPLETADO';
|
|
RAISE NOTICE '══════════════════════════════════════════════════════════════';
|
|
RAISE NOTICE 'Prototipos: %', v_prototipos;
|
|
RAISE NOTICE 'Fraccionamientos: %', v_fraccionamientos;
|
|
RAISE NOTICE 'Etapas: %', v_etapas;
|
|
RAISE NOTICE 'Manzanas: %', v_manzanas;
|
|
RAISE NOTICE 'Torres: %', v_torres;
|
|
RAISE NOTICE 'Niveles: %', v_niveles;
|
|
RAISE NOTICE 'Lotes: %', v_lotes;
|
|
RAISE NOTICE 'Departamentos: %', v_departamentos;
|
|
RAISE NOTICE 'Subcontratistas: %', v_subcontratistas;
|
|
RAISE NOTICE '══════════════════════════════════════════════════════════════';
|
|
END $$;
|
|
|
|
COMMIT;
|
|
|
|
-- ═══════════════════════════════════════════════════════════════════════════════
|
|
-- FIN SEED 04
|
|
-- ═══════════════════════════════════════════════════════════════════════════════
|