[Qa-jenkins-scm] [jenkins.debian.net] 02/06: reproducible Debian: add auto incrementing to postgres id columns
Holger Levsen
holger at layer-acht.org
Mon Dec 19 11:23:35 UTC 2016
This is an automated email from the git hooks/post-receive script.
holger pushed a commit to branch master
in repository jenkins.debian.net.
commit 95585e3dac27ffb9089fb5dafeb7b831d466743c
Author: Valerie R Young <spectranaut at riseup.net>
Date: Thu Sep 15 11:36:29 2016 -0400
reproducible Debian: add auto incrementing to postgres id columns
This commit makes reproducible_db_maintence.py no longer compatible
with a sqlite database.
Sqlite primary key id fields automatically autoincrement. To copy this
functionality to the new postgresql database, the table id columns must be
altered using postgres specific commands.
Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
bin/reproducible_db_maintenance.py | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/bin/reproducible_db_maintenance.py b/bin/reproducible_db_maintenance.py
index aa53715..bace961 100755
--- a/bin/reproducible_db_maintenance.py
+++ b/bin/reproducible_db_maintenance.py
@@ -573,6 +573,24 @@ schema_updates = {
'''DROP TABLE stats_meta_pkg_state;''',
'''ALTER TABLE stats_meta_pkg_state_tmp RENAME TO stats_meta_pkg_state;''',
"INSERT INTO rb_schema (version, date) VALUES (28, '" + now + "')"],
+
+ # THE FOLLOWING UPDATE CAN ONLY BE PREFORMED ON POSTGRES DATABASE
+
+ 29: [ # Add auto incrementing to the id columns of some tables
+ "CREATE SEQUENCE schedule_id_seq",
+ "ALTER TABLE schedule ALTER id SET DEFAULT NEXTVAL('schedule_id_seq')",
+ "CREATE SEQUENCE manual_scheduler_id_seq",
+ """ALTER TABLE manual_scheduler ALTER id SET DEFAULT
+ NEXTVAL('manual_scheduler_id_seq')""",
+ "CREATE SEQUENCE sources_id_seq",
+ "ALTER TABLE sources ALTER id SET DEFAULT NEXTVAL('sources_id_seq')",
+ "CREATE SEQUENCE stats_build_id_seq",
+ """ALTER TABLE stats_build ALTER id SET DEFAULT
+ NEXTVAL('stats_build_id_seq')""",
+ "CREATE SEQUENCE results_id_seq",
+ "ALTER TABLE results ALTER id SET DEFAULT NEXTVAL('results_id_seq')",
+ "INSERT INTO rb_schema (version, date) VALUES (29, '" + now + "')"
+ ],
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/qa/jenkins.debian.net.git
More information about the Qa-jenkins-scm
mailing list