Saltar a contenido

PDF-011B - B2B Local Dev DDL Execution

Estado: GO B2B LOCAL DEV DDL EXECUTED / OBJETOS B2B CREADOS / SIN DATOS

Fecha: 2026-06-23

Resumen

Se ejecuto en PostgreSQL local/dev el DDL B2B corregido PDF-010P usando openclaw_bo_admin contra gestion_de_negocios_core.

La ejecucion partio del backup schema-only valido generado en PDF-011A y no cargo datos B2B.

Safe point

  • HEAD inicial despues de publicar PDF-011A: b40c84dcef93030f3d8efcd7b28561eee6df5c59.
  • origin/main despues de publicar PDF-011A: b40c84dcef93030f3d8efcd7b28561eee6df5c59.
  • VPS Knowledge Portal despues de deploy PDF-011A: b40c84dcef93030f3d8efcd7b28561eee6df5c59.
  • Working tree inicial PDF-011B: limpio.

Credencial admin/owner local/dev

Fuente revisada sin imprimir valores:

text C:\APV\openclawai\.venv-portal\secrets\postgres-target-admin-owner.env

Confirmaciones:

  • El archivo existe.
  • Esta ignorado por Git.
  • Contiene variables APV_DESTINATION_POSTGRES_ADMIN_*.
  • No se imprimieron passwords ni connection strings completas.

Backup previo usado

Backup valido usado como evidencia previa:

text C:\APV\backups\openclawai\PDF-011A\business_observer_schema_only_post_owner_grants.dump

Resultado:

  • Existe.
  • Esta fuera de Git.
  • Tamano: 13895 bytes.
  • Tamano mayor a 0: SI.

Preflight read-only local/dev

Resultado previo al DDL:

  • current_database: gestion_de_negocios_core.
  • current_user: openclaw_bo_admin.
  • schema business_observer: existe.
  • schema owner: openclaw_bo_admin.
  • openclaw_bo_admin tiene CREATE sobre DB: true.
  • openclaw_bo_admin tiene CREATE sobre schema: true.
  • roles presentes:
  • openclaw_bo_admin
  • openclaw_bo_writer
  • openclaw_bo_reader
  • objetos B2B ausentes antes del DDL:
  • business_observer.b2b_customer_mapping
  • business_observer.b2b_product_price
  • business_observer.b2b_pricing_decision_log
  • business_observer.v_b2b_customer_effective_price

DDL ejecutado

Se ejecuto unicamente:

text infra/business-observer/production/b2b-pricing/PDF-010P/PDF-010P-B2B-PERSISTENCE-DDL-RETRY-CANDIDATE.sql

Condiciones:

  • ON_ERROR_STOP=1.
  • Transaccion unica con psql -1.
  • Sin ejecutar otros SQL write.
  • Sin rollback automatico.

Resultado SQL:

  • CREATE TABLE: 3.
  • CREATE INDEX: 8.
  • CREATE VIEW: 1.
  • ALTER TABLE/VIEW OWNER: aplicado.
  • ENABLE ROW LEVEL SECURITY: aplicado en 3 tablas.
  • GRANT: aplicado para roles openclaw_bo_admin, openclaw_bo_writer y openclaw_bo_reader.

Objetos creados

  • business_observer.b2b_customer_mapping: tabla, owner openclaw_bo_admin.
  • business_observer.b2b_product_price: tabla, owner openclaw_bo_admin.
  • business_observer.b2b_pricing_decision_log: tabla, owner openclaw_bo_admin.
  • business_observer.v_b2b_customer_effective_price: vista, owner openclaw_bo_admin.

Post-checks read-only

Resultado:

  • Objetos B2B esperados presentes: 4/4.
  • Constraints totales B2B: 24.
  • Indices totales B2B observados: 11, incluyendo:
  • ux_b2b_customer_mapping_active_wc_customer
  • ux_b2b_customer_mapping_active_sgc_customer
  • ux_b2b_product_price_current
  • ux_b2b_product_price_valid_from
  • ix_b2b_customer_mapping_price_list
  • ix_b2b_product_price_lookup
  • ix_b2b_pricing_decision_log_customer
  • ix_b2b_pricing_decision_log_sku
  • Duplicados por nombre en business_observer para objetos b2b_%: 0.

Permisos, grants y RLS

Resultado:

  • RLS activo:
  • business_observer.b2b_customer_mapping: true
  • business_observer.b2b_product_price: true
  • business_observer.b2b_pricing_decision_log: true
  • openclaw_bo_admin: ALL PRIVILEGES sobre tablas/vista B2B.
  • openclaw_bo_writer:
  • SELECT, INSERT, UPDATE sobre b2b_customer_mapping.
  • SELECT, INSERT, UPDATE sobre b2b_product_price.
  • SELECT, INSERT sobre b2b_pricing_decision_log.
  • SELECT sobre v_b2b_customer_effective_price.
  • openclaw_bo_reader:
  • SELECT sobre b2b_customer_mapping.
  • SELECT sobre b2b_product_price.
  • SELECT sobre v_b2b_customer_effective_price.
  • USAGE sobre schema business_observer confirmado para openclaw_bo_admin, openclaw_bo_writer y openclaw_bo_reader.

Rollback candidate disponible

Rollback candidate versionado, no ejecutado:

text infra/business-observer/production/b2b-pricing/PDF-010P/PDF-010P-B2B-PERSISTENCE-ROLLBACK-RETRY-CANDIDATE.sql

Que NO se hizo

  • No se uso VPS/prod.
  • No se toco WooCommerce API.
  • No se modifico .env.
  • No se imprimieron secrets ni connection strings completas.
  • No se modifico runtime.
  • No se ejecuto sync, scheduler, cron ni pipelines.
  • No se cargaron datos B2B.
  • No se ejecutaron inserts masivos.
  • No se ejecutaron updates, deletes ni truncate.
  • No se tocaron objetos fuera del schema business_observer ni fuera de los objetos B2B autorizados.

GO/NO-GO final

GO B2B LOCAL DEV DDL EXECUTED / OBJETOS B2B CREADOS / SIN DATOS.

Proximo paso

Preparar un gate separado para carga B2B controlada local/dev con datos minimos o snapshot aprobado. Produccion sigue bloqueada hasta autorizacion especifica, backup/snapshot productivo y preflight dedicado.