db/structure.sql difference with scripts/regenerate-schema
With multiple databases setup, we see differences with db/structure.sql
Steps to reproduce:
-
Setup multiple databases
$ gdk config set gitlab.rails.databases.ci.use_main_database false $ gdk reconfigure
-
Run
./scripts/regenerate-schema
-
Run
git diff db/structure.sql
I suspect this difference arises from how partitioned tables are setup /cc @pbair
Click to expand
index c335b686557..1f83293cddc 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -214,26 +214,6 @@ RETURN NULL;
END
$$;
-CREATE TABLE audit_events (
- id bigint NOT NULL,
- author_id integer NOT NULL,
- entity_id integer NOT NULL,
- entity_type character varying NOT NULL,
- details text,
- ip_address inet,
- author_name text,
- entity_path text,
- target_details text,
- created_at timestamp without time zone NOT NULL,
- target_type text,
- target_id bigint,
- CONSTRAINT check_492aaa021d CHECK ((char_length(entity_path) <= 5500)),
- CONSTRAINT check_83ff8406e2 CHECK ((char_length(author_name) <= 255)),
- CONSTRAINT check_97a8c868e7 CHECK ((char_length(target_type) <= 255)),
- CONSTRAINT check_d493ec90b5 CHECK ((char_length(target_details) <= 5500))
-)
-PARTITION BY RANGE (created_at);
-
CREATE TABLE batched_background_migration_job_transition_logs (
id bigint NOT NULL,
batched_background_migration_job_id bigint NOT NULL,
+CREATE TABLE audit_events (
+ id bigint NOT NULL,
+ author_id integer NOT NULL,
+ entity_id integer NOT NULL,
+ entity_type character varying NOT NULL,
+ details text,
+ ip_address inet,
+ author_name text,
+ entity_path text,
+ target_details text,
+ created_at timestamp without time zone NOT NULL,
+ target_type text,
+ target_id bigint,
+ CONSTRAINT check_492aaa021d CHECK ((char_length(entity_path) <= 5500)),
+ CONSTRAINT check_83ff8406e2 CHECK ((char_length(author_name) <= 255)),
+ CONSTRAINT check_97a8c868e7 CHECK ((char_length(target_type) <= 255)),
+ CONSTRAINT check_d493ec90b5 CHECK ((char_length(target_details) <= 5500))
+)
+PARTITION BY RANGE (created_at);
+
CREATE TABLE audit_events_external_audit_event_destinations (
id bigint NOT NULL,
namespace_id bigint NOT NULL,
Proposal
In dev/test main/ci, always create a partition for partitioned tables so that the pg_dump
ordering is stable. (pg_dump
moves partitioned tables to the top if it has partitions, otherwise it does not)
Edited by Thong Kuah