screwdriver-data-schema 21.26.0 → 21.26.1

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.
package/config/base.js CHANGED
@@ -47,8 +47,7 @@ const SCHEMA_STAGE = Joi.object()
47
47
  description: Joi.string(),
48
48
  jobs: Joi.array()
49
49
  .items(Job.jobName)
50
- .min(0),
51
- color: Joi.string().regex(Regex.STAGE_COLOR)
50
+ .min(0)
52
51
  })
53
52
  .unknown(false);
54
53
 
package/config/regex.js CHANGED
@@ -49,8 +49,6 @@ module.exports = {
49
49
  INTERNAL_TRIGGER: /^~([\w-]+)$/,
50
50
  // Stages can only be named with A-Z,a-z,0-9,-,_
51
51
  STAGE_NAME: /^[\w-]+$/,
52
- // Stages can only be named with valid hex CSS color
53
- STAGE_COLOR: /^#(?:[0-9a-fA-F]{3}){1,2}$/,
54
52
 
55
53
  // Don't combine EXTERNAL_TRIGGER and EXTERNAL_TRIGGER_AND for backward compatibility
56
54
  // BlockBy does not support EXTERNAL_TRIGGER_AND
@@ -0,0 +1,51 @@
1
+ /* eslint-disable new-cap */
2
+
3
+ 'use strict';
4
+
5
+ const prefix = process.env.DATASTORE_SEQUELIZE_PREFIX || '';
6
+ const table = `${prefix}stages`;
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
+ try {
13
+ await queryInterface.removeColumn(table, 'color');
14
+
15
+ await queryInterface.removeColumn(table, 'state');
16
+
17
+ await queryInterface.addColumn(
18
+ table,
19
+ 'groupEventId',
20
+ {
21
+ type: Sequelize.DOUBLE
22
+ },
23
+ { transaction }
24
+ );
25
+
26
+ await queryInterface.addColumn(
27
+ table,
28
+ 'createTime',
29
+ {
30
+ type: Sequelize.STRING(32)
31
+ },
32
+ { transaction }
33
+ );
34
+
35
+ await queryInterface.addConstraint(table, {
36
+ name: `${table}_pipeline_id_name_group_event_id_key`,
37
+ fields: ['pipelineId', 'name', 'groupEventId'],
38
+ type: 'unique',
39
+ transaction
40
+ });
41
+
42
+ await queryInterface.addIndex(table, {
43
+ name: `${table}_group_event_id_create_time`,
44
+ fields: ['groupEventId', 'createTime'],
45
+ transaction
46
+ });
47
+ // eslint-disable-next-line no-empty
48
+ } catch (e) {}
49
+ });
50
+ }
51
+ };
package/models/stage.js CHANGED
@@ -33,23 +33,20 @@ const MODEL = {
33
33
  )
34
34
  .description('Job IDs in this Stage'),
35
35
 
36
- state: Joi.string()
37
- .valid('ARCHIVED', 'ACTIVE')
38
- .max(10)
39
- .description('Current state of the Stage')
40
- .example('ARCHIVED')
41
- .default('ACTIVE'),
42
-
43
36
  description: Joi.string()
44
37
  .max(256)
45
38
  .description('Description of the Stage')
46
39
  .example('Deploys canary jobs'),
47
40
 
48
- color: Joi.string()
49
- .regex(Regex.STAGE_COLOR)
50
- .max(7)
51
- .description('Color for the Stage')
52
- .example('#FFFF00')
41
+ groupEventId: Joi.number()
42
+ .integer()
43
+ .positive()
44
+ .description('Identifier of the group event')
45
+ .example(123345),
46
+
47
+ createTime: Joi.string()
48
+ .isoDate()
49
+ .description('When this stage was created')
53
50
  };
54
51
 
55
52
  module.exports = {
@@ -75,7 +72,7 @@ module.exports = {
75
72
  * @property keys
76
73
  * @type {Array}
77
74
  */
78
- keys: ['pipelineId', 'name'],
75
+ keys: ['pipelineId', 'name', 'groupEventId'],
79
76
 
80
77
  /**
81
78
  * List of all fields in the model
@@ -98,5 +95,5 @@ module.exports = {
98
95
  * @property indexes
99
96
  * @type {Array}
100
97
  */
101
- indexes: [{ fields: ['pipelineId'] }]
98
+ indexes: [{ fields: ['pipelineId'] }, { fields: ['groupEventId', 'createTime'] }]
102
99
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "screwdriver-data-schema",
3
- "version": "21.26.0",
3
+ "version": "21.26.1",
4
4
  "description": "Internal Data Schema of Screwdriver",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -50,12 +50,12 @@
50
50
  "npx": "^10.2.2",
51
51
  "nyc": "^15.0.0",
52
52
  "pg": "^7.18.2",
53
- "sequelize": "^6.21.0",
53
+ "sequelize": "^6.21.3",
54
54
  "sequelize-cli": "^6.4.1",
55
55
  "sqlite3": "^4.2.0"
56
56
  },
57
57
  "dependencies": {
58
- "cron-parser": "^4.4.0",
58
+ "cron-parser": "^4.5.0",
59
59
  "joi": "^17.6.0"
60
60
  }
61
61
  }