diff --git a/database/migrations/V1.4.0.2__initial_schema.ddl b/database/migrations/V1.4.0.2__initial_schema.ddl index 3740825..7551417 100644 --- a/database/migrations/V1.4.0.2__initial_schema.ddl +++ b/database/migrations/V1.4.0.2__initial_schema.ddl @@ -17,6 +17,7 @@ -- Run header rows for the runs topic. CREATE TABLE IF NOT EXISTS public_cps_za_runs ( + internal_id SERIAL PRIMARY KEY, event_id VARCHAR(255) NOT NULL, job_ref VARCHAR(255) NOT NULL, tenant_id VARCHAR(255) NOT NULL, @@ -42,6 +43,7 @@ CREATE TABLE IF NOT EXISTS public_cps_za_runs_jobs ( -- Data lake change events. CREATE TABLE IF NOT EXISTS public_cps_za_dlchange ( + internal_id SERIAL PRIMARY KEY, event_id VARCHAR(255) NOT NULL, tenant_id VARCHAR(255) NOT NULL, source_app VARCHAR(255) NOT NULL, diff --git a/database/migrations/V1.4.0.3__grants.ddl b/database/migrations/V1.4.0.3__grants.ddl index c61b563..770e85d 100644 --- a/database/migrations/V1.4.0.3__grants.ddl +++ b/database/migrations/V1.4.0.3__grants.ddl @@ -47,7 +47,9 @@ GRANT SELECT, INSERT, UPDATE ON TABLE TO eventgate_writer; -- Writer needs the SERIAL sequence (public_cps_za_runs_jobs.internal_id) to insert. +GRANT USAGE, SELECT ON SEQUENCE public.public_cps_za_runs_internal_id_seq TO eventgate_writer; GRANT USAGE, SELECT ON SEQUENCE public.public_cps_za_runs_jobs_internal_id_seq TO eventgate_writer; +GRANT USAGE, SELECT ON SEQUENCE public.public_cps_za_dlchange_internal_id_seq TO eventgate_writer; -- Default privileges for objects the owner creates in the future. -- Executed as eventgate_owner: on managed Postgres (Aurora/RDS) the migration user is not a true superuser