← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/db-git-more into lp:launchpad/db-devel

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/db-git-more into lp:launchpad/db-devel.

Commit message:
Add GitRepository.description, flesh out GitRef, and add GitJob.

Requested reviews:
  Stuart Bishop (stub): db
  Launchpad code reviewers (launchpad-reviewers): db
Related bugs:
  Bug #1032731 in Launchpad itself: "Support for Launchpad-hosted Git repositories"
  https://bugs.launchpad.net/launchpad/+bug/1032731

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/db-git-more/+merge/252672

Here are some more Git-related database changes, mostly for the ref scanner.  I fleshed out GitRef with some information about the tip commit of the ref so that we can show that in repository-level summary views in the web UI, and added a GitJob table which is enough to make the ref scanner work.

Also, GitRepository.description seems like a sensible thing to have, and doesn't seem worth splitting into a separate patch given that none of these tables contain any data outside of development systems yet.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/db-git-more into lp:launchpad/db-devel.
=== modified file 'database/sampledata/current-dev.sql'
--- database/sampledata/current-dev.sql	2015-01-27 17:22:08 +0000
+++ database/sampledata/current-dev.sql	2015-03-11 23:58:48 +0000
@@ -3857,6 +3857,16 @@
 ALTER TABLE garbojobstate ENABLE TRIGGER ALL;
 
 
+ALTER TABLE gitjob DISABLE TRIGGER ALL;
+
+
+
+ALTER TABLE gitjob ENABLE TRIGGER ALL;
+
+
+
+
+
 ALTER TABLE gitref DISABLE TRIGGER ALL;
 
 
@@ -3870,9 +3880,6 @@
 
 
 
-
-
-
 ALTER TABLE hwvendorname DISABLE TRIGGER ALL;
 
 INSERT INTO hwvendorname (id, name) VALUES (1, 'MSI');

=== modified file 'database/sampledata/current.sql'
--- database/sampledata/current.sql	2015-01-27 17:22:08 +0000
+++ database/sampledata/current.sql	2015-03-11 23:58:48 +0000
@@ -3784,6 +3784,16 @@
 ALTER TABLE garbojobstate ENABLE TRIGGER ALL;
 
 
+ALTER TABLE gitjob DISABLE TRIGGER ALL;
+
+
+
+ALTER TABLE gitjob ENABLE TRIGGER ALL;
+
+
+
+
+
 ALTER TABLE gitref DISABLE TRIGGER ALL;
 
 
@@ -3797,9 +3807,6 @@
 
 
 
-
-
-
 ALTER TABLE hwvendorname DISABLE TRIGGER ALL;
 
 INSERT INTO hwvendorname (id, name) VALUES (1, 'MSI');

=== added file 'database/schema/patch-2209-61-2.sql'
--- database/schema/patch-2209-61-2.sql	1970-01-01 00:00:00 +0000
+++ database/schema/patch-2209-61-2.sql	2015-03-11 23:58:48 +0000
@@ -0,0 +1,38 @@
+-- Copyright 2015 Canonical Ltd.  This software is licensed under the
+-- GNU Affero General Public License version 3 (see the file LICENSE).
+
+SET client_min_messages=ERROR;
+
+ALTER TABLE GitRepository ADD COLUMN description text;
+
+COMMENT ON COLUMN GitRepository.description IS 'A short description of this repository.';
+
+ALTER TABLE GitRef ADD COLUMN object_type integer NOT NULL;
+ALTER TABLE GitRef ADD COLUMN author integer REFERENCES revisionauthor;
+ALTER TABLE GitRef ADD COLUMN author_date timestamp without time zone;
+ALTER TABLE GitRef ADD COLUMN committer integer REFERENCES revisionauthor;
+ALTER TABLE GitRef ADD COLUMN committer_date timestamp without time zone;
+ALTER TABLE GitRef ADD COLUMN commit_message text;
+
+COMMENT ON COLUMN GitRef.object_type IS 'The type of object pointed to by this reference.';
+COMMENT ON COLUMN GitRef.author IS 'The author of the commit pointed to by this reference.';
+COMMENT ON COLUMN GitRef.author_date IS 'The author date of the commit pointed to by this reference.';
+COMMENT ON COLUMN GitRef.committer IS 'The committer of the commit pointed to by this reference.';
+COMMENT ON COLUMN GitRef.committer_date IS 'The committer date of the commit pointed to by this reference.';
+COMMENT ON COLUMN GitRef.commit_message IS 'The commit message of the commit pointed to by this reference.';
+
+CREATE TABLE GitJob (
+    id serial PRIMARY KEY,
+    job integer NOT NULL REFERENCES job,
+    repository integer NOT NULL REFERENCES gitrepository,
+    job_type integer NOT NULL,
+    json_data text
+);
+
+COMMENT ON TABLE GitJob IS 'Contains references to jobs that are executed for a Git repository.';
+COMMENT ON COLUMN GitJob.job IS 'A reference to a Job row that has all the common job details.';
+COMMENT ON COLUMN GitJob.repository IS 'The repository that this job is for.';
+COMMENT ON COLUMN GitJob.job_type IS 'The type of job, such as a ref scan.';
+COMMENT ON COLUMN GitJob.json_data IS 'Data that is specific to a particular job type.';
+
+INSERT INTO LaunchpadDatabaseRevision VALUES (2209, 61, 2);

=== modified file 'database/schema/security.cfg'
--- database/schema/security.cfg	2015-02-10 00:45:38 +0000
+++ database/schema/security.cfg	2015-03-11 23:58:48 +0000
@@ -196,6 +196,7 @@
 public.featureflag                      = SELECT, INSERT, UPDATE, DELETE
 public.featureflagchangelogentry        = SELECT, INSERT, UPDATE
 public.flatpackagesetinclusion          = SELECT, INSERT, UPDATE, DELETE
+public.gitjob                           = SELECT, INSERT, UPDATE, DELETE
 public.gitref                           = SELECT, INSERT, UPDATE, DELETE
 public.gitrepository                    = SELECT, INSERT, UPDATE, DELETE
 public.hwdevice                         = SELECT
@@ -687,6 +688,7 @@
 public.distributionsourcepackage          = SELECT, UPDATE
 public.distroseries                       = SELECT
 public.emailaddress                       = SELECT
+public.gitjob                             = SELECT, INSERT, UPDATE, DELETE
 public.gitref                             = SELECT, INSERT, UPDATE, DELETE
 public.gitrepository                      = SELECT, UPDATE
 public.incrementaldiff                    = SELECT
@@ -2278,6 +2280,7 @@
 public.diff                             = SELECT, DELETE
 public.emailaddress                     = SELECT, UPDATE, DELETE
 public.garbojobstate                    = SELECT, INSERT, UPDATE, DELETE
+public.gitjob                           = SELECT, DELETE
 public.hwsubmission                     = SELECT, UPDATE
 public.job                              = SELECT, INSERT, DELETE
 public.latestpersonsourcepackagereleasecache = SELECT, INSERT, UPDATE


References