Rename commit_set_relationships to commit_set_items
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 21 Apr 2017 21:31:06 +0000 (21:31 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 21 Apr 2017 21:31:06 +0000 (21:31 +0000)
https://bugs.webkit.org/show_bug.cgi?id=171143

Reviewed by Joseph Pecoraro.

Renamed commit_set_relationships to commit_set_items. Also added commitset_patch_file in the preparation to add
the support for applying patches in custom test groups. To migrate an existing database, run:

```sql
BEGIN;
ALTER TABLE commit_set_relationships RENAME TO commit_set_items;
ALTER TABLE commit_set_items ADD COLUMN commitset_patch_file integer REFERENCES uploaded_files;
ALTER TABLE commit_set_items ADD CONSTRAINT commitset_with_patch_must_have_commit
    CHECK (commitset_patch_file IS NULL OR commitset_commit IS NOT NULL);
END;
```

* init-database.sql:
* public/include/build-requests-fetcher.php:
* public/privileged-api/create-test-group.php:
* server-tests/resources/mock-data.js:
(MockData.addMockData):
(MockData.addMockTestGroupWithGitWebKit):
* tools/js/database.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@215640 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Websites/perf.webkit.org/ChangeLog
Websites/perf.webkit.org/init-database.sql
Websites/perf.webkit.org/public/include/build-requests-fetcher.php
Websites/perf.webkit.org/public/privileged-api/create-test-group.php
Websites/perf.webkit.org/server-tests/resources/mock-data.js
Websites/perf.webkit.org/tools/js/database.js

index 45050d2..7ae44f6 100644 (file)
@@ -1,5 +1,32 @@
 2017-04-21  Ryosuke Niwa  <rniwa@webkit.org>
 
+        Rename commit_set_relationships to commit_set_items
+        https://bugs.webkit.org/show_bug.cgi?id=171143
+
+        Reviewed by Joseph Pecoraro.
+
+        Renamed commit_set_relationships to commit_set_items. Also added commitset_patch_file in the preparation to add
+        the support for applying patches in custom test groups. To migrate an existing database, run:
+
+        ```sql
+        BEGIN;
+        ALTER TABLE commit_set_relationships RENAME TO commit_set_items;
+        ALTER TABLE commit_set_items ADD COLUMN commitset_patch_file integer REFERENCES uploaded_files;
+        ALTER TABLE commit_set_items ADD CONSTRAINT commitset_with_patch_must_have_commit
+            CHECK (commitset_patch_file IS NULL OR commitset_commit IS NOT NULL);
+        END;
+        ```
+
+        * init-database.sql:
+        * public/include/build-requests-fetcher.php:
+        * public/privileged-api/create-test-group.php:
+        * server-tests/resources/mock-data.js:
+        (MockData.addMockData):
+        (MockData.addMockTestGroupWithGitWebKit):
+        * tools/js/database.js:
+
+2017-04-21  Ryosuke Niwa  <rniwa@webkit.org>
+
         Add the support for creating a custom test group in the analysis task page
 
         Make it possible to create more custom test groups in the analysis task page
index 8a153e9..427344b 100644 (file)
@@ -29,7 +29,7 @@ DROP TABLE IF EXISTS uploaded_files CASCADE;
 DROP TABLE IF EXISTS bugs CASCADE;
 DROP TABLE IF EXISTS analysis_test_groups CASCADE;
 DROP TABLE IF EXISTS commit_sets CASCADE;
-DROP TABLE IF EXISTS commit_set_relationships CASCADE;
+DROP TABLE IF EXISTS commit_set_items CASCADE;
 DROP TABLE IF EXISTS build_requests CASCADE;
 DROP TYPE IF EXISTS build_request_status_type CASCADE;
 
@@ -283,11 +283,13 @@ CREATE INDEX testgroup_task_index ON analysis_test_groups(testgroup_task);
 CREATE TABLE commit_sets (
     commitset_id serial PRIMARY KEY);
 
-CREATE TABLE commit_set_relationships (
+CREATE TABLE commit_set_items (
     commitset_set integer REFERENCES commit_sets NOT NULL,
     commitset_commit integer REFERENCES commits,
+    commitset_patch_file integer REFERENCES uploaded_files,
     commitset_root_file integer REFERENCES uploaded_files,
-    CONSTRAINT commitset_must_have_commit_or_root CHECK (commitset_commit IS NOT NULL OR commitset_root_file IS NOT NULL));
+    CONSTRAINT commitset_must_have_commit_or_root CHECK (commitset_commit IS NOT NULL OR commitset_root_file IS NOT NULL),
+    CONSTRAINT commitset_with_patch_must_have_commit CHECK (commitset_patch_file IS NULL OR commitset_commit IS NOT NULL));
 
 CREATE TYPE build_request_status_type as ENUM ('pending', 'scheduled', 'running', 'failed', 'completed', 'canceled');
 CREATE TABLE build_requests (
index 1f51cf6..e0396aa 100644 (file)
@@ -95,7 +95,7 @@ class BuildRequestsFetcher {
             return;
 
         $commit_rows = $this->db->query_and_fetch_all('SELECT *
-            FROM commit_set_relationships LEFT OUTER JOIN  commits ON commitset_commit = commit_id
+            FROM commit_set_items LEFT OUTER JOIN  commits ON commitset_commit = commit_id
                 LEFT OUTER JOIN repositories ON repository_id = commit_repository
                 WHERE commitset_set = $1', array($commit_set_id));
 
index ba0abd1..e0e5843 100644 (file)
@@ -85,7 +85,7 @@ function main()
         $commit_set_id = $db->insert_row('commit_sets', 'commitset', array());
         foreach ($commit_list['set'] as $commit_row) {
             $commit_row['set'] = $commit_set_id;
-            $db->insert_row('commit_set_relationships', 'commitset', $commit_row, 'commit');
+            $db->insert_row('commit_set_items', 'commitset', $commit_row, 'commit');
         }
         array_push($configuration_list, array('commit_set' => $commit_set_id, 'repository_group' => $commit_list['repository_group']));
     }
index 1cb3262..e4b9e59 100644 (file)
@@ -49,11 +49,11 @@ MockData = {
             db.insert('test_configurations', {id: 302, metric: 300, platform: MockData.otherPlatformId(), type: 'current'}),
             db.insert('test_runs', {id: 801, config: 301, build: 901, mean_cache: 100}),
             db.insert('commit_sets', {id: 401}),
-            db.insert('commit_set_relationships', {set: 401, commit: 87832}),
-            db.insert('commit_set_relationships', {set: 401, commit: 93116}),
+            db.insert('commit_set_items', {set: 401, commit: 87832}),
+            db.insert('commit_set_items', {set: 401, commit: 93116}),
             db.insert('commit_sets', {id: 402}),
-            db.insert('commit_set_relationships', {set: 402, commit: 87832}),
-            db.insert('commit_set_relationships', {set: 402, commit: 96336}),
+            db.insert('commit_set_items', {set: 402, commit: 87832}),
+            db.insert('commit_set_items', {set: 402, commit: 96336}),
             db.insert('analysis_tasks', {id: 500, platform: 65, metric: 300, name: 'some task',
                 start_run: 801, start_run_time: '2015-10-27T12:05:27.1Z',
                 end_run: 801, end_run_time: '2015-10-27T12:05:27.1Z'}),
@@ -85,11 +85,11 @@ MockData = {
             db.insert('commits', {id: 193116, repository: this.gitWebkitRepositoryId(), revision: '2ceda45d3cd63cde58d0dbf5767714e03d902e43', time: (new Date(1445945816878)).toISOString()}),
             db.insert('commits', {id: 196336, repository: this.gitWebkitRepositoryId(), revision: '8e294365a452a89785d6536ca7f0fc8a95fa152d', time: (new Date(1448225325650)).toISOString()}),
             db.insert('commit_sets', {id: 1401}),
-            db.insert('commit_set_relationships', {set: 1401, commit: 87832}),
-            db.insert('commit_set_relationships', {set: 1401, commit: 193116}),
+            db.insert('commit_set_items', {set: 1401, commit: 87832}),
+            db.insert('commit_set_items', {set: 1401, commit: 193116}),
             db.insert('commit_sets', {id: 1402}),
-            db.insert('commit_set_relationships', {set: 1402, commit: 87832}),
-            db.insert('commit_set_relationships', {set: 1402, commit: 196336}),
+            db.insert('commit_set_items', {set: 1402, commit: 87832}),
+            db.insert('commit_set_items', {set: 1402, commit: 196336}),
             db.insert('analysis_test_groups', {id: 1600, task: 500, name: 'test group with git'}),
             db.insert('build_requests', {id: 1700, status: 'pending', triggerable: 1000, repository_group: 2002, platform: 65, test: 200, group: 1600, order: 0, commit_set: 1401}),
             db.insert('build_requests', {id: 1701, status: 'pending', triggerable: 1000, repository_group: 2002, platform: 65, test: 200, group: 1600, order: 1, commit_set: 1402}),
index 4fbd332..ee8d4ff 100644 (file)
@@ -151,7 +151,7 @@ const tableToPrefixMap = {
     'reports': 'report',
     'repositories': 'repository',
     'commit_sets': 'commitset',
-    'commit_set_relationships': 'commitset',
+    'commit_set_items': 'commitset',
     'run_iterations': 'iteration',
     'uploaded_files': 'file',
 }