screwdriver-data-schema 22.4.5 → 22.5.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.
package/api/status.js CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  const Joi = require('joi');
4
4
 
5
- const SCHEMA_STATUS = Joi.string().valid('OK');
5
+ const SCHEMA_STATUS = Joi.alternatives().try(
6
+ Joi.string().valid('OK'),
7
+ Joi.object({
8
+ queue: Joi.string(),
9
+ store: Joi.string(),
10
+ api: Joi.string()
11
+ }).required()
12
+ );
6
13
 
7
14
  module.exports = SCHEMA_STATUS;
@@ -8,45 +8,39 @@ const table = `${prefix}stages`;
8
8
  module.exports = {
9
9
  up: async (queryInterface, Sequelize) => {
10
10
  await queryInterface.sequelize.transaction(async transaction => {
11
- try {
12
- await queryInterface.removeColumn(table, 'groupEventId');
11
+ await queryInterface.removeColumn(table, 'groupEventId', { transaction });
13
12
 
14
- await queryInterface.addColumn(
15
- table,
16
- 'setup',
17
- {
18
- type: Sequelize.INTEGER
19
- },
20
- { transaction }
21
- );
22
- await queryInterface.addColumn(
23
- table,
24
- 'teardown',
25
- {
26
- type: Sequelize.INTEGER
27
- },
28
- { transaction }
29
- );
30
- await queryInterface.addColumn(
31
- table,
32
- 'archived',
33
- {
34
- type: Sequelize.BOOLEAN
35
- },
36
- { transaction }
37
- );
38
- await queryInterface.removeConstraint(table, `${table}_pipeline_id_name_group_event_id_key`, {
39
- transaction
40
- });
13
+ await queryInterface.addConstraint(table, {
14
+ fields: ['pipelineId', 'name'],
15
+ name: `${table}_pipeline_id_name_key`,
16
+ type: 'unique',
17
+ transaction
18
+ });
41
19
 
42
- await queryInterface.addConstraint(table, {
43
- fields: ['pipelineId', 'name'],
44
- name: `${table}_pipeline_id_name_key`,
45
- type: 'unique',
46
- transaction
47
- });
48
- // eslint-disable-next-line no-empty
49
- } catch (e) {}
20
+ await queryInterface.addColumn(
21
+ table,
22
+ 'setup',
23
+ {
24
+ type: Sequelize.INTEGER
25
+ },
26
+ { transaction }
27
+ );
28
+ await queryInterface.addColumn(
29
+ table,
30
+ 'teardown',
31
+ {
32
+ type: Sequelize.INTEGER
33
+ },
34
+ { transaction }
35
+ );
36
+ await queryInterface.addColumn(
37
+ table,
38
+ 'archived',
39
+ {
40
+ type: Sequelize.BOOLEAN
41
+ },
42
+ { transaction }
43
+ );
50
44
  });
51
45
  }
52
46
  };
@@ -0,0 +1,72 @@
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
+ async up(queryInterface, Sequelize) {
10
+ const transaction = await queryInterface.sequelize.transaction();
11
+
12
+ try {
13
+ await queryInterface.dropTable(table, {
14
+ transaction
15
+ });
16
+
17
+ await queryInterface.createTable(
18
+ table,
19
+ {
20
+ id: {
21
+ allowNull: false,
22
+ autoIncrement: true,
23
+ primaryKey: true,
24
+ type: Sequelize.INTEGER.UNSIGNED
25
+ },
26
+ pipelineId: {
27
+ type: Sequelize.DOUBLE
28
+ },
29
+ name: {
30
+ type: Sequelize.STRING(64)
31
+ },
32
+ jobIds: {
33
+ type: Sequelize.TEXT
34
+ },
35
+ description: {
36
+ type: Sequelize.STRING(256)
37
+ },
38
+ setup: {
39
+ type: Sequelize.INTEGER
40
+ },
41
+ teardown: {
42
+ type: Sequelize.INTEGER
43
+ },
44
+ archived: {
45
+ type: Sequelize.BOOLEAN
46
+ },
47
+ workflowGraph: {
48
+ type: Sequelize.TEXT
49
+ }
50
+ },
51
+ { transaction }
52
+ );
53
+ await queryInterface.addConstraint(table, {
54
+ name: `${table}_pipeline_id_name_key`,
55
+ fields: ['pipelineId', 'name'],
56
+ type: 'unique',
57
+ transaction
58
+ });
59
+
60
+ await queryInterface.addIndex(table, {
61
+ name: `${table}_pipeline_id`,
62
+ fields: ['pipelineId'],
63
+ transaction
64
+ });
65
+
66
+ await transaction.commit();
67
+ } catch (e) {
68
+ await transaction.rollback();
69
+ throw e;
70
+ }
71
+ }
72
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "screwdriver-data-schema",
3
- "version": "22.4.5",
3
+ "version": "22.5.0",
4
4
  "description": "Internal Data Schema of Screwdriver",
5
5
  "main": "index.js",
6
6
  "scripts": {