Skip to content

Commit

Permalink
Merge pull request #1190 from Amsterdam/bugfix/update-default-pks-db-…
Browse files Browse the repository at this point in the history
…for-azure

Executed query for default id
  • Loading branch information
remyvdwereld authored Feb 8, 2024
2 parents 7669ca7 + 37c6228 commit 42c4e31
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 1 deletion.
27 changes: 27 additions & 0 deletions app/apps/cases/migrations/0024_alter_default_column_ids_azure.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Generated by Django 3.2.13 on 2024-02-08 13:36

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
("cases", "0023_add_multiple_tags"),
]

operations = [
migrations.RunSQL(
sql="""
DO $$
BEGIN
-- cases_casetheme
IF NOT EXISTS (SELECT FROM pg_class c JOIN pg_namespace n ON n.oid = c.relnamespace WHERE c.relkind = 'S' AND c.relname = 'cases_casetheme_id_seq' AND n.nspname = 'public') THEN
CREATE SEQUENCE public.cases_casetheme_id_seq INCREMENT BY 1 START WITH 1 MINVALUE 1 NO MAXVALUE CACHE 1;
END IF;
END
$$;
ALTER TABLE cases_casetheme ALTER COLUMN id SET DEFAULT nextval('public.cases_casetheme_id_seq'::regclass);
"""
)
]
27 changes: 27 additions & 0 deletions app/apps/events/migrations/0002_alter_default_column_ids_azure.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Generated by Django 3.2.13 on 2024-02-08 15:19

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
("events", "0001_initial"),
]

operations = [
migrations.RunSQL(
sql="""
DO $$
BEGIN
-- events_caseevent
IF NOT EXISTS (SELECT FROM pg_class c JOIN pg_namespace n ON n.oid = c.relnamespace WHERE c.relkind = 'S' AND c.relname = 'events_caseevent_id_seq' AND n.nspname = 'public') THEN
CREATE SEQUENCE public.events_caseevent_id_seq INCREMENT BY 1 START WITH 1 MINVALUE 1 NO MAXVALUE CACHE 1;
END IF;
END
$$;
ALTER TABLE events_caseevent ALTER COLUMN id SET DEFAULT nextval('public.events_caseevent_id_seq'::regclass);
"""
)
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Generated by Django 3.2.13 on 2024-02-08 15:19

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
("schedules", "0004_schedule_housing_corporation_combiteam"),
]

operations = [
migrations.RunSQL(
sql="""
DO $$
BEGIN
-- schedules_action
IF NOT EXISTS (SELECT FROM pg_class c JOIN pg_namespace n ON n.oid = c.relnamespace WHERE c.relkind = 'S' AND c.relname = 'schedules_action_id_seq' AND n.nspname = 'public') THEN
CREATE SEQUENCE public.schedules_action_id_seq INCREMENT BY 1 START WITH 1 MINVALUE 1 NO MAXVALUE CACHE 1;
END IF;
END
$$;
ALTER TABLE schedules_action ALTER COLUMN id SET DEFAULT nextval('public.schedules_action_id_seq'::regclass);
"""
)
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Generated by Django 3.2.13 on 2024-02-08 15:19

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
("workflow", "0008_workflowoption_enabled_on_case_closed"),
]

operations = [
migrations.RunSQL(
sql="""
DO $$
BEGIN
-- workflow_caseusertask
IF NOT EXISTS (SELECT FROM pg_class c JOIN pg_namespace n ON n.oid = c.relnamespace WHERE c.relkind = 'S' AND c.relname = 'workflow_caseusertask_id_seq' AND n.nspname = 'public') THEN
CREATE SEQUENCE public.workflow_caseusertask_id_seq INCREMENT BY 1 START WITH 1 MINVALUE 1 NO MAXVALUE CACHE 1;
END IF;
-- workflow_caseworkflow
IF NOT EXISTS (SELECT FROM pg_class c JOIN pg_namespace n ON n.oid = c.relnamespace WHERE c.relkind = 'S' AND c.relname = 'workflow_caseworkflow_id_seq' AND n.nspname = 'public') THEN
CREATE SEQUENCE public.workflow_caseworkflow_id_seq INCREMENT BY 1 START WITH 1 MINVALUE 1 NO MAXVALUE CACHE 1;
END IF;
END
$$;
ALTER TABLE workflow_caseusertask ALTER COLUMN id SET DEFAULT nextval('public.workflow_caseusertask_id_seq'::regclass);
ALTER TABLE workflow_caseworkflow ALTER COLUMN id SET DEFAULT nextval('public.workflow_caseworkflow_id_seq'::regclass);
"""
)
]
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ services:
database:
networks:
- zaken_network
image: amsterdam/postgres11
image: amsterdam/postgres12
shm_size: "512m"
ports:
- "6409:5432"
Expand Down

0 comments on commit 42c4e31

Please sign in to comment.