feat(platform): complete the Gelios external data loop

This commit is contained in:
Codex
2026-07-20 20:45:05 +03:00
parent def9a24e0d
commit 8a7465cf0e
66 changed files with 5730 additions and 123 deletions
+20 -1
View File
@@ -12,14 +12,33 @@ export async function migrate(pool) {
delivery_mode text not null,
semantic_types jsonb not null,
fields jsonb not null,
field_contracts jsonb not null default '{}'::jsonb,
history_policy jsonb not null,
active boolean not null default true,
created_at timestamptz not null default now(),
updated_at timestamptz not null default now(),
check (jsonb_typeof(semantic_types) = 'array' and jsonb_array_length(semantic_types) > 0),
check (jsonb_typeof(fields) = 'array' and jsonb_array_length(fields) > 0)
check (jsonb_typeof(fields) = 'array' and jsonb_array_length(fields) > 0),
constraint external_data_plane_products_field_contracts_object_ck
check (jsonb_typeof(field_contracts) = 'object')
)
`);
await pool.query("alter table external_data_plane_products add column if not exists field_contracts jsonb not null default '{}'::jsonb");
await pool.query(`
do $$
begin
if not exists (
select 1 from pg_constraint
where conrelid = 'external_data_plane_products'::regclass
and conname = 'external_data_plane_products_field_contracts_object_ck'
) then
alter table external_data_plane_products
add constraint external_data_plane_products_field_contracts_object_ck
check (jsonb_typeof(field_contracts) = 'object');
end if;
end
$$
`);
await pool.query(`
create table if not exists external_data_plane_batches (