fix(edp): resolve managed reader source scope
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { backfillManagedReaderSourceConnections } from "./reader-source-scope.mjs";
|
||||
|
||||
export async function migrate(pool) {
|
||||
await pool.query("create extension if not exists timescaledb");
|
||||
await pool.query("create extension if not exists postgis");
|
||||
@@ -160,6 +162,7 @@ export async function migrate(pool) {
|
||||
await pool.query("alter table external_data_plane_reader_bindings add column if not exists binding_key text");
|
||||
await pool.query("alter table external_data_plane_reader_bindings add column if not exists request_hash text");
|
||||
await pool.query("alter table external_data_plane_reader_bindings add column if not exists generation integer not null default 1");
|
||||
await pool.query("alter table external_data_plane_reader_bindings add column if not exists source_connection_id text");
|
||||
await pool.query("alter table external_data_plane_reader_bindings alter column expires_at drop not null");
|
||||
await pool.query(`
|
||||
do $$
|
||||
@@ -202,6 +205,13 @@ export async function migrate(pool) {
|
||||
`);
|
||||
await pool.query("create unique index if not exists external_data_plane_reader_bindings_managed_key_idx on external_data_plane_reader_bindings (binding_key, generation) where binding_key is not null");
|
||||
await pool.query("create index if not exists external_data_plane_reader_bindings_active_idx on external_data_plane_reader_bindings (active, expires_at)");
|
||||
await pool.query("create index if not exists external_data_plane_reader_bindings_source_idx on external_data_plane_reader_bindings (tenant_id, source_connection_id, provider_id, active)");
|
||||
await pool.query(`
|
||||
update external_data_plane_reader_bindings
|
||||
set source_connection_id = connection_id
|
||||
where binding_key is null and source_connection_id is null
|
||||
`);
|
||||
await backfillManagedReaderSourceConnections(pool);
|
||||
|
||||
await pool.query(`
|
||||
create table if not exists external_data_plane_facts (
|
||||
|
||||
Reference in New Issue
Block a user