Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions database/apply_all_required_migrations.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
\set ON_ERROR_STOP on
\echo 'Aplicando baseline canônico SIGOV PLUS (somente entradas declaradas includeInBaseline=true; automáticas e históricas são governadas pelo manifest)...'
\echo 'Aplicando baseline canônico SIGOV PLUS...'

\i /database/script_completo.sql

Expand All @@ -13,4 +13,4 @@ insert into sigov.docker_schema_migrations (name)
values ('00000000000000_script_completo_baseline')
on conflict (name) do nothing;

\echo 'Baseline canônico SIGOV PLUS aplicado com sucesso.'
\echo 'Baseline canônico SIGOV PLUS aplicado com sucesso.'
2 changes: 1 addition & 1 deletion database/postgres/migrations/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@
"file": "20260722120000_enterprise_tenant_mapping.sql",
"checksum": "5de9eef9b5ef879f374093df3e78db27dd4528fb9e5badae9b5c59680642d0a7",
"category": "schema",
"includeInBaseline": false,
"includeInBaseline": true,
"applyAutomatically": true
},
{
Expand Down
30 changes: 29 additions & 1 deletion database/postgres/script_completo.sql
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ select exists (
('20260709120000', array['db364a5699b6d8c2a679eda8cc9f545fd4bea7333ec420be2c03fa64dc7c6784']::text[]),
('20260713120000', array['50c5782933e893879759ed0e2f1bcc8b309eca3526cec1e85415b8adc3c39dc7']::text[]),
('20260721120000', array['3a6e2e05531dd3d6a725a2a31c86592d6ce1c8ad5f06142ce0d9bec4e55b387f','5a35264947577114e11300bbc664a5753fb1e66622af1d5507340f5168b3cc06','ac05a6a00abac143e77fc6e4fdb715e61ae446073ed1018c3aca61cd64b0d86d','0cb296d5d5d0c035eff4030678d19e801430a0e370a5a2803ce014d17cf22c9e']::text[]),
('20260722120000', array['5de9eef9b5ef879f374093df3e78db27dd4528fb9e5badae9b5c59680642d0a7']::text[]),
('20260727120000', array['177f36a01775fbc78039e1f77555def37ed0e15442946530bd55f5bd9539c62d','ed5ed4c70113601f5b00844ff5df342b1d80b684e422659da87bf553ecc3d662']::text[]),
('20260727160000', array['bac96f2ba1336226e29c46746a046b672b9588e1f9611fb3ff316b95f0fdf9b8']::text[]),
('20260730090000', array['cbd5cac3058c6483df9e17fe20ebb37ca8c2bebeac2115d8b4c956b74b56193c']::text[]),
Expand Down Expand Up @@ -9625,6 +9626,34 @@ drop function if exists pg_temp.create_index_when_columns_exist(text,text,text,t
drop function if exists pg_temp.create_index_when_columns_exist(text,text,text,text[],text,text);
drop function if exists pg_temp.ensure_schema_safe_index(text,text,text,text[],text);

-- ==================================================
-- MIGRATION: 20260722120000_enterprise_tenant_mapping.sql
-- CATEGORY: schema
-- CHECKSUM_SHA256: 5de9eef9b5ef879f374093df3e78db27dd4528fb9e5badae9b5c59680642d0a7
-- ==================================================
create table if not exists sigov.enterprise_tenant_mapping (
id bigserial primary key,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Correct the baseline PK to use identity

On a clean one-shot installation, the newly included baseline creates enterprise_tenant_mapping.id as bigserial, which is sequence-backed rather than the required bigint generated ... as identity. This now ships a nonconforming persistent schema in every synchronized baseline; introduce a corrective schema migration using the required identity form and regenerate the baselines.

AGENTS.md reference: AGENTS.md:L6-L6

Useful? React with 👍 / 👎.

core_tenant_id bigint not null,
enterprise_tenant_id uuid not null,
ativo boolean not null default true,
created_at timestamptz not null default now(),
updated_at timestamptz null,
constraint uq_enterprise_tenant_mapping_core unique (core_tenant_id),
constraint uq_enterprise_tenant_mapping_enterprise unique (enterprise_tenant_id),
constraint ck_enterprise_tenant_mapping_not_empty check (enterprise_tenant_id <> '00000000-0000-0000-0000-000000000000'::uuid)
);

create index if not exists idx_enterprise_tenant_mapping_core_tenant_id on sigov.enterprise_tenant_mapping (core_tenant_id);
create index if not exists idx_enterprise_tenant_mapping_enterprise_tenant_id on sigov.enterprise_tenant_mapping (enterprise_tenant_id);
create index if not exists idx_enterprise_tenant_mapping_ativo on sigov.enterprise_tenant_mapping (ativo);

insert into sigov.schema_migrations(version, description, checksum, category, source, success, execution_ms, applied_at) values ('20260722120000', 'Enterprise tenant mapping', '5de9eef9b5ef879f374093df3e78db27dd4528fb9e5badae9b5c59680642d0a7', 'schema', 'script_completop', true, null, now()) on conflict (version) do update set description = excluded.description, checksum = excluded.checksum, category = excluded.category, source = excluded.source, success = true;

-- Reset de helpers temporários entre migrations concatenadas.
drop function if exists pg_temp.create_index_when_columns_exist(text,text,text,text[],text);
drop function if exists pg_temp.create_index_when_columns_exist(text,text,text,text[],text,text);
drop function if exists pg_temp.ensure_schema_safe_index(text,text,text,text[],text);

-- ==================================================
-- MIGRATION: 20260727120000_pos_rc_27b2_tarefa_canonica.sql
-- CATEGORY: schema
Expand Down Expand Up @@ -30771,7 +30800,6 @@ create unique index if not exists ux_bootstrap_grupo_nome_tenant
\endif

-- EXCLUDED_FROM_BASELINE: 011_seed_sigov_dev.sql [development-seed]
-- EXCLUDED_FROM_BASELINE: 20260722120000_enterprise_tenant_mapping.sql [schema]
-- EXCLUDED_FROM_BASELINE: 20260902000000_rc50_98_ged_workflow_branding_logo.sql [schema]
-- EXCLUDED_FROM_BASELINE: 20260902010000_corr_compras_checksum_schema.sql [schema]
-- EXCLUDED_FROM_BASELINE: 20260903130000_corr_licitapro_postconditions_schema.sql [corrective]
30 changes: 29 additions & 1 deletion database/postgres/script_completo_dev.sql
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ select exists (
('20260709120000', array['db364a5699b6d8c2a679eda8cc9f545fd4bea7333ec420be2c03fa64dc7c6784']::text[]),
('20260713120000', array['50c5782933e893879759ed0e2f1bcc8b309eca3526cec1e85415b8adc3c39dc7']::text[]),
('20260721120000', array['3a6e2e05531dd3d6a725a2a31c86592d6ce1c8ad5f06142ce0d9bec4e55b387f','5a35264947577114e11300bbc664a5753fb1e66622af1d5507340f5168b3cc06','ac05a6a00abac143e77fc6e4fdb715e61ae446073ed1018c3aca61cd64b0d86d','0cb296d5d5d0c035eff4030678d19e801430a0e370a5a2803ce014d17cf22c9e']::text[]),
('20260722120000', array['5de9eef9b5ef879f374093df3e78db27dd4528fb9e5badae9b5c59680642d0a7']::text[]),
('20260727120000', array['177f36a01775fbc78039e1f77555def37ed0e15442946530bd55f5bd9539c62d','ed5ed4c70113601f5b00844ff5df342b1d80b684e422659da87bf553ecc3d662']::text[]),
('20260727160000', array['bac96f2ba1336226e29c46746a046b672b9588e1f9611fb3ff316b95f0fdf9b8']::text[]),
('20260730090000', array['cbd5cac3058c6483df9e17fe20ebb37ca8c2bebeac2115d8b4c956b74b56193c']::text[]),
Expand Down Expand Up @@ -9625,6 +9626,34 @@ drop function if exists pg_temp.create_index_when_columns_exist(text,text,text,t
drop function if exists pg_temp.create_index_when_columns_exist(text,text,text,text[],text,text);
drop function if exists pg_temp.ensure_schema_safe_index(text,text,text,text[],text);

-- ==================================================
-- MIGRATION: 20260722120000_enterprise_tenant_mapping.sql
-- CATEGORY: schema
-- CHECKSUM_SHA256: 5de9eef9b5ef879f374093df3e78db27dd4528fb9e5badae9b5c59680642d0a7
-- ==================================================
create table if not exists sigov.enterprise_tenant_mapping (
id bigserial primary key,
core_tenant_id bigint not null,
enterprise_tenant_id uuid not null,
ativo boolean not null default true,
created_at timestamptz not null default now(),
updated_at timestamptz null,
constraint uq_enterprise_tenant_mapping_core unique (core_tenant_id),
constraint uq_enterprise_tenant_mapping_enterprise unique (enterprise_tenant_id),
constraint ck_enterprise_tenant_mapping_not_empty check (enterprise_tenant_id <> '00000000-0000-0000-0000-000000000000'::uuid)
);

create index if not exists idx_enterprise_tenant_mapping_core_tenant_id on sigov.enterprise_tenant_mapping (core_tenant_id);
create index if not exists idx_enterprise_tenant_mapping_enterprise_tenant_id on sigov.enterprise_tenant_mapping (enterprise_tenant_id);
create index if not exists idx_enterprise_tenant_mapping_ativo on sigov.enterprise_tenant_mapping (ativo);

insert into sigov.schema_migrations(version, description, checksum, category, source, success, execution_ms, applied_at) values ('20260722120000', 'Enterprise tenant mapping', '5de9eef9b5ef879f374093df3e78db27dd4528fb9e5badae9b5c59680642d0a7', 'schema', 'script_completop', true, null, now()) on conflict (version) do update set description = excluded.description, checksum = excluded.checksum, category = excluded.category, source = excluded.source, success = true;

-- Reset de helpers temporários entre migrations concatenadas.
drop function if exists pg_temp.create_index_when_columns_exist(text,text,text,text[],text);
drop function if exists pg_temp.create_index_when_columns_exist(text,text,text,text[],text,text);
drop function if exists pg_temp.ensure_schema_safe_index(text,text,text,text[],text);

-- ==================================================
-- MIGRATION: 20260727120000_pos_rc_27b2_tarefa_canonica.sql
-- CATEGORY: schema
Expand Down Expand Up @@ -30771,7 +30800,6 @@ create unique index if not exists ux_bootstrap_grupo_nome_tenant
\endif

-- EXCLUDED_FROM_BASELINE: 011_seed_sigov_dev.sql [development-seed]
-- EXCLUDED_FROM_BASELINE: 20260722120000_enterprise_tenant_mapping.sql [schema]
-- EXCLUDED_FROM_BASELINE: 20260902000000_rc50_98_ged_workflow_branding_logo.sql [schema]
-- EXCLUDED_FROM_BASELINE: 20260902010000_corr_compras_checksum_schema.sql [schema]
-- EXCLUDED_FROM_BASELINE: 20260903130000_corr_licitapro_postconditions_schema.sql [corrective]
Expand Down
30 changes: 29 additions & 1 deletion database/script_completo.sql
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ select exists (
('20260709120000', array['db364a5699b6d8c2a679eda8cc9f545fd4bea7333ec420be2c03fa64dc7c6784']::text[]),
('20260713120000', array['50c5782933e893879759ed0e2f1bcc8b309eca3526cec1e85415b8adc3c39dc7']::text[]),
('20260721120000', array['3a6e2e05531dd3d6a725a2a31c86592d6ce1c8ad5f06142ce0d9bec4e55b387f','5a35264947577114e11300bbc664a5753fb1e66622af1d5507340f5168b3cc06','ac05a6a00abac143e77fc6e4fdb715e61ae446073ed1018c3aca61cd64b0d86d','0cb296d5d5d0c035eff4030678d19e801430a0e370a5a2803ce014d17cf22c9e']::text[]),
('20260722120000', array['5de9eef9b5ef879f374093df3e78db27dd4528fb9e5badae9b5c59680642d0a7']::text[]),
('20260727120000', array['177f36a01775fbc78039e1f77555def37ed0e15442946530bd55f5bd9539c62d','ed5ed4c70113601f5b00844ff5df342b1d80b684e422659da87bf553ecc3d662']::text[]),
('20260727160000', array['bac96f2ba1336226e29c46746a046b672b9588e1f9611fb3ff316b95f0fdf9b8']::text[]),
('20260730090000', array['cbd5cac3058c6483df9e17fe20ebb37ca8c2bebeac2115d8b4c956b74b56193c']::text[]),
Expand Down Expand Up @@ -9625,6 +9626,34 @@ drop function if exists pg_temp.create_index_when_columns_exist(text,text,text,t
drop function if exists pg_temp.create_index_when_columns_exist(text,text,text,text[],text,text);
drop function if exists pg_temp.ensure_schema_safe_index(text,text,text,text[],text);

-- ==================================================
-- MIGRATION: 20260722120000_enterprise_tenant_mapping.sql
-- CATEGORY: schema
-- CHECKSUM_SHA256: 5de9eef9b5ef879f374093df3e78db27dd4528fb9e5badae9b5c59680642d0a7
-- ==================================================
create table if not exists sigov.enterprise_tenant_mapping (
id bigserial primary key,
core_tenant_id bigint not null,
enterprise_tenant_id uuid not null,
ativo boolean not null default true,
created_at timestamptz not null default now(),
updated_at timestamptz null,
constraint uq_enterprise_tenant_mapping_core unique (core_tenant_id),
constraint uq_enterprise_tenant_mapping_enterprise unique (enterprise_tenant_id),
constraint ck_enterprise_tenant_mapping_not_empty check (enterprise_tenant_id <> '00000000-0000-0000-0000-000000000000'::uuid)
);

create index if not exists idx_enterprise_tenant_mapping_core_tenant_id on sigov.enterprise_tenant_mapping (core_tenant_id);
create index if not exists idx_enterprise_tenant_mapping_enterprise_tenant_id on sigov.enterprise_tenant_mapping (enterprise_tenant_id);
create index if not exists idx_enterprise_tenant_mapping_ativo on sigov.enterprise_tenant_mapping (ativo);

insert into sigov.schema_migrations(version, description, checksum, category, source, success, execution_ms, applied_at) values ('20260722120000', 'Enterprise tenant mapping', '5de9eef9b5ef879f374093df3e78db27dd4528fb9e5badae9b5c59680642d0a7', 'schema', 'script_completop', true, null, now()) on conflict (version) do update set description = excluded.description, checksum = excluded.checksum, category = excluded.category, source = excluded.source, success = true;

-- Reset de helpers temporários entre migrations concatenadas.
drop function if exists pg_temp.create_index_when_columns_exist(text,text,text,text[],text);
drop function if exists pg_temp.create_index_when_columns_exist(text,text,text,text[],text,text);
drop function if exists pg_temp.ensure_schema_safe_index(text,text,text,text[],text);

-- ==================================================
-- MIGRATION: 20260727120000_pos_rc_27b2_tarefa_canonica.sql
-- CATEGORY: schema
Expand Down Expand Up @@ -30771,7 +30800,6 @@ create unique index if not exists ux_bootstrap_grupo_nome_tenant
\endif

-- EXCLUDED_FROM_BASELINE: 011_seed_sigov_dev.sql [development-seed]
-- EXCLUDED_FROM_BASELINE: 20260722120000_enterprise_tenant_mapping.sql [schema]
-- EXCLUDED_FROM_BASELINE: 20260902000000_rc50_98_ged_workflow_branding_logo.sql [schema]
-- EXCLUDED_FROM_BASELINE: 20260902010000_corr_compras_checksum_schema.sql [schema]
-- EXCLUDED_FROM_BASELINE: 20260903130000_corr_licitapro_postconditions_schema.sql [corrective]
16 changes: 9 additions & 7 deletions docs/execucao/BACKLOG_EXECUTAVEL.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ Estados: APROVADO (escopo autorizado), EM_EXECUCAO, VALIDADO (com evidência), B
| Ordem | Item | Estado inicial | Aceite |
|---|---|---|---|
| 1 | P0.1-A inventário e gate estático de governança das migrations | VALIDADO | 184 arquivos classificados, checksums, prefixos, duplicidades, compatibilidades, política lexical, histórico e scripts verificados |
| 2 | P0.1-B convergência em PostgreSQL 16 vazio/legado | EM_EXECUCAO | Vazio+reaplicação PASS em PG16.15:5433; equivalência/legado BLOCKED por instabilidade do Docker Desktop |
| 3 | P0.2 build Release locked e suites realmente executadas | VALIDADO | `dotnet build sigov.sln -c Release -warnaserror` e `dotnet test` 389/123/102 em 2026-09-10 |
| 4 | P0.3 ApiExplorer/Swagger/OpenAPI/rotas | EM_EXECUCAO | Rotas 630 PASS; Swagger HTTP 200 obtido na API local contra PG16 Gate A (~3,4 MiB) |
| 5 | P0.4 login, sessões, cache, revogação e dois tenants | EM_EXECUCAO | Hash admin/superadmin PASS; login HTTP/MinhaCentral/isolamento BLOCKED (PG16 caiu no meio do teste) |
| 6 | P1.1–P1.6 catálogo, entitlements, preços, administrações e menu | AGUARDA_GATE | Gate B não avançado: exige Gate A runtime verde; catálogo Commercial e B2 completo pendentes |
| 7 | P2.1–P2.8 Indústria por fluxo vertical | AGUARDA_GATE | Gate C bloqueado até A e B verdes; telas ainda genéricas |
| 2 | P0.1-B convergência em PostgreSQL 16 vazio/legado | EM_EXECUCAO | Vazio+reaplicação PASS em PG16.15 Podman:5433; equivalência/legado ainda BLOCKED |
| 3 | P0.2 build Release locked e suites realmente executadas | VALIDADO | `dotnet build` Api/Web Release e IconRegistryTests 6/6 em 2026-09-10 |
| 4 | P0.3 ApiExplorer/Swagger/OpenAPI/rotas | VALIDADO | Swagger HTTP 200 (3 445 457 bytes) na API local contra PG16 Gate A |
| 5 | P0.4 login, sessões, cache, revogação e dois tenants | EM_EXECUCAO | Login e-mail/login/CPF/CNPJ + MinhaCentral + logout PASS; dois tenants/legado BLOCKED |
| 6 | P1.1–P1.6 catálogo, entitlements, preços, administrações e menu | AGUARDA_GATE | RC51.02C Gate 2 não iniciado; unificar Commercial→SaaS e completar Admin SaaS |
| 7 | P2.1–P2.8 Indústria OP vertical | AGUARDA_GATE | RC51.02C Gate 3 não iniciado; telas ainda genéricas (`ModulePage`) |
| 7a | Fatias Compras/Almoxarifado, Jurídico, Educação | AGUARDA_GATE | RC51.02C Gate 4 após Gates 1–3 |
| 7b | Demais módulos na ordem do contrato | AGUARDA_GATE | Atualizar backlog após Gate 4; GED por último |
| 8 | P3 Indústria avançada | AGUARDA_GATE | Core industrial validado |
| 9 | P4 demais módulos na ordem do contrato | AGUARDA_GATE | Auditoria por fluxo, sem telas decorativas |
| 10 | GED | AGUARDA_GATE | Último módulo; anteriores sem PARCIAL/ESTRUTURA pendente, salvo adiamento formal |

Próximo item exato: PostgreSQL 16 descartável e Gate A runtime (vazio/reaplicação/legado/equivalência, Swagger 200, login/dois tenants). Gate B e Gate C não avançam enquanto A estiver BLOCKED. GED continua por último.
Próximo item exato: fechar equivalência one-shot e isolamento de dois tenants em PG16; só então Gate 2 (SaaS Admin). Gates 3–5 e GED não avançam enquanto Gate 1 estiver incompleto.
4 changes: 2 additions & 2 deletions docs/execucao/STATUS_REAL_MODULOS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Status real dos módulos

Corte: 2026-09-10; origin/main `8b6e867b2e76638d5d809ca6a3462b1d7d60756c` (pós PR #382 e commits `ajuste`/`sasa`/`aDASDAs`).
Corte: 2026-09-10; origin/main `dc7c1ac23f0c4ee95d7362e149157f2bec8284dc` (pós PR #384).
Inventário documental: docs/inventario-modulos-sigov.md, docs/execucao/rc50_67_plano_homologacao_integrada_real.md e docs/roadmap/saas-industria-auditoria.md. Classificação conservadora: os 15 requisitos do contrato não foram demonstrados conjuntamente em runtime.

| Domínio/módulos existentes | Status | Evidência existente e lacuna de aprovação |
Expand All @@ -26,5 +26,5 @@ Inventário documental: docs/inventario-modulos-sigov.md, docs/execucao/rc50_67_
| Legislativo, transparência, diário oficial, convênios, trânsito, defesa | PARCIAL | Inventários e controllers existentes; verificar cada fluxo após P0–P3 |
| GED e assinaturas | PARCIAL | Estrutura histórica existente; catálogo rebaixado para não promover GED na RC51.00; implementação bloqueada até última fase |

Nenhum módulo foi promovido a FUNCIONAL, HOMOLOGADO ou PRODUCAO. RC51.02A reparou a regressão de artefatos/segredo no main; Gate A runtime, Gate B e Gate C permanecem BLOCKED. Indústria Core segue PARCIAL (telas genéricas e timer de sucesso).
Nenhum módulo foi promovido a FUNCIONAL, HOMOLOGADO ou PRODUCAO. RC51.02C evidenciou apply/reapply/Swagger e autenticação HTTP (login/MinhaCentral/logout, CPF/CNPJ) em PG16 via Podman; equivalência one-shot e isolamento de dois tenants seguem BLOCKED. Indústria Core permanece PARCIAL (telas genéricas). GED continua por último.

Loading
Loading