Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 57 additions & 5 deletions database scripts/01_django.sql
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,9 @@ CREATE INDEX "django_session_session_key_c0390e0f_like" ON "public"."django_sess
-- TOC entry 3722 (class 2606 OID 20267)
-- Name: auth_permission auth_permission_content_type_id_2f476e4b_fk_django_co; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY "public"."auth_permission"
ADD CONSTRAINT "auth_permission_content_type_id_2f476e4b_fk_django_co" FOREIGN KEY ("content_type_id") REFERENCES "public"."django_content_type"("id") DEFERRABLE INITIALLY DEFERRED;
-- duplication of "auth_permission_content_type_id_2f476e4b_fk_django_co" constraint
-- ALTER TABLE ONLY "public"."auth_permission"
-- ADD CONSTRAINT "auth_permission_content_type_id_2f476e4b_fk_django_co" FOREIGN KEY ("content_type_id") REFERENCES "public"."django_content_type"("id") DEFERRABLE INITIALLY DEFERRED;


--
Expand Down Expand Up @@ -276,7 +276,7 @@ CREATE TABLE "public"."auth_permission" (
);


ALTER TABLE "public"."auth_permission" OWNER TO "postgres";
-- ALTER TABLE "public"."auth_permission" OWNER TO "postgres";

--
-- TOC entry 206 (class 1259 OID 20241)
Expand All @@ -292,7 +292,7 @@ CREATE SEQUENCE "public"."auth_permission_id_seq"
CACHE 1;


ALTER TABLE "public"."auth_permission_id_seq" OWNER TO "postgres";
-- ALTER TABLE "public"."auth_permission_id_seq" OWNER TO "postgres";

--
-- TOC entry 3993 (class 0 OID 0)
Expand Down Expand Up @@ -333,6 +333,58 @@ ALTER TABLE ONLY "public"."auth_permission"

CREATE INDEX "auth_permission_content_type_id_2f476e4b" ON "public"."auth_permission" USING "btree" ("content_type_id");


--
-- Table: public.auth_group
--

CREATE TABLE "public"."auth_group" (
"id" serial PRIMARY KEY,
"name" varchar(150) NOT NULL
);

--
-- Constraints
--

ALTER TABLE ONLY "public"."auth_group"
ADD CONSTRAINT "auth_group_name_a6ea08ec_uniq" UNIQUE ("name");


--
-- Table: public.auth_group_permissions
--

CREATE TABLE "public"."auth_group_permissions" (
"id" serial PRIMARY KEY,
"group_id" integer NOT NULL,
"permission_id" integer NOT NULL
);


--
-- Foreign Keys
--

ALTER TABLE ONLY "public"."auth_group_permissions"
ADD CONSTRAINT "auth_group_permissions_permission_id_84c5c92e_fk_auth_permission_id"
FOREIGN KEY ("permission_id") REFERENCES "public"."auth_permission"("id") DEFERRABLE INITIALLY DEFERRED;


--
-- Indexes
--

CREATE INDEX "auth_group_permissions_group_id_b120cbf9"
ON "public"."auth_group_permissions" ("group_id");

CREATE INDEX "auth_group_permissions_permission_id_84c5c92e"
ON "public"."auth_group_permissions" ("permission_id");

CREATE UNIQUE INDEX "auth_group_permissions_group_id_permission_id_0cd325b0_uniq"
ON "public"."auth_group_permissions" ("group_id", "permission_id")
WHERE ("group_id" IS NOT NULL AND "permission_id" IS NOT NULL);

--
-- TOC entry 3724 (class 2606 OID 20281)
-- Name: auth_group_permissions auth_group_permissio_permission_id_84c5c92e_fk_auth_perm; Type: FK CONSTRAINT; Schema: public; Owner: postgres
Expand Down
7 changes: 5 additions & 2 deletions database scripts/01_modular_base.sql
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,10 @@ CREATE TABLE "public"."core_User" (
"i_user_id" integer,
"t_user_id" "uuid",
claim_admin_id integer,
officer_id integer
officer_id integer,
"LegacyID" "uuid",
"ValidityFrom" timestamp with time zone NOT NULL,
"ValidityTo" timestamp with time zone
);


Expand Down Expand Up @@ -268,7 +271,7 @@ ALTER SEQUENCE "public"."core_User_user_permissions_id_seq" OWNED BY "public"."c
create table "public"."core_UserMutation"
(
id uuid primary key,
core_user_id integer not null,
core_user_id "uuid" not null,
mutation_id uuid not null
);

Expand Down
6 changes: 5 additions & 1 deletion migtool/migtool.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,11 @@ def migrate():
col_default = extract_sequence_name(row[1])
if col_default:
sequence_columns[row[0]] = col_default
old_cols_list.append(row[0])
# Wrap column names in brackets if they contain spaces or hyphens,
col_name = row[0]
if ' ' in col_name or '-' in col_name:
col_name = f"[{col_name}]"
old_cols_list.append(col_name)
new_cols_list.append(f'"{row[0]}"')
old_cols = ", ".join(old_cols_list)
new_cols = "(" + ", ".join(new_cols_list) + ")"
Expand Down