screwdriver-data-schema 25.1.3 → 25.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,19 @@
1
+ /* eslint-disable new-cap */
2
+
3
+ 'use strict';
4
+
5
+ const prefix = process.env.DATASTORE_SEQUELIZE_PREFIX || '';
6
+ const table = `${prefix}jobs`;
7
+
8
+ module.exports = {
9
+ // eslint-disable-next-line no-unused-vars
10
+ up: async (queryInterface, Sequelize) => {
11
+ await queryInterface.sequelize.transaction(async transaction => {
12
+ await queryInterface.addIndex(table, {
13
+ name: `${table}_pipelineId_archived`,
14
+ fields: ['pipelineId', 'archived'],
15
+ transaction
16
+ });
17
+ });
18
+ }
19
+ };
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+
3
+ const prefix = process.env.DATASTORE_SEQUELIZE_PREFIX || '';
4
+ const table = `${prefix}pipelines`;
5
+
6
+ module.exports = {
7
+ up: async (queryInterface, Sequelize) => {
8
+ await queryInterface.sequelize.transaction(async transaction => {
9
+ await queryInterface.addColumn(
10
+ table,
11
+ 'adminUserIds',
12
+ {
13
+ type: Sequelize.TEXT,
14
+ defaultValue: '[]',
15
+ allowNull: false
16
+ },
17
+ { transaction }
18
+ );
19
+ });
20
+ }
21
+ };
package/models/job.js CHANGED
@@ -140,5 +140,10 @@ module.exports = {
140
140
  * @property indexes
141
141
  * @type {Array}
142
142
  */
143
- indexes: [{ fields: ['pipelineId', 'state'] }, { fields: ['state'] }, { fields: ['templateId', 'archived'] }]
143
+ indexes: [
144
+ { fields: ['pipelineId', 'state'] },
145
+ { fields: ['state'] },
146
+ { fields: ['templateId', 'archived'] },
147
+ { fields: ['pipelineId', 'archived'] }
148
+ ]
144
149
  };
@@ -63,8 +63,17 @@ const MODEL = {
63
63
 
64
64
  createTime: Joi.string().isoDate().description('When this pipeline was created'),
65
65
 
66
+ // This holds the SCM usernames belonging to the pipeline SCM context who have admin privileges.
67
+ // This should eventually be completely replaced by adminUserIds. Keeping this for now for backward compatibility.
66
68
  admins: Joi.object().description('Admins of this Pipeline').example({ myself: true }),
67
69
 
70
+ // Besides users from the pipeline SCM context, this can hold users outside pipeline SCM context who have admin privileges for this pipeline.
71
+ adminUserIds: Joi.array()
72
+ .items(Joi.number().integer().positive().description('Identifier of the user').example(12345))
73
+ .description('IDs of the users who have admin privileges for this pipeline')
74
+ .default([])
75
+ .required(),
76
+
68
77
  workflowGraph: WorkflowGraph.workflowGraph.description('Graph representation of the workflow'),
69
78
 
70
79
  annotations: Annotations.annotations.description('Pipeline-level annotations'),
@@ -151,7 +160,7 @@ module.exports = {
151
160
  get: Joi.object(
152
161
  mutate(
153
162
  MODEL,
154
- ['id', 'scmUri', 'scmContext', 'createTime', 'admins', 'state'],
163
+ ['id', 'scmUri', 'scmContext', 'createTime', 'admins', 'adminUserIds', 'state'],
155
164
  [
156
165
  'workflowGraph',
157
166
  'scmRepo',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "screwdriver-data-schema",
3
- "version": "25.1.3",
3
+ "version": "25.2.0",
4
4
  "description": "Internal Data Schema of Screwdriver",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -50,8 +50,8 @@
50
50
  "mysql2": "^1.7.0",
51
51
  "npx": "^3.0.0",
52
52
  "nyc": "^15.1.0",
53
- "pg": "^7.18.2",
54
- "sequelize": "^6.37.5",
53
+ "pg": "^8.14.1",
54
+ "sequelize": "^6.37.6",
55
55
  "sequelize-cli": "^6.6.2",
56
56
  "sqlite3": "^5.1.7"
57
57
  },