screwdriver-data-schema 26.0.0 → 26.1.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.
|
@@ -9,8 +9,7 @@ module.exports = {
|
|
|
9
9
|
// eslint-disable-next-line no-unused-vars
|
|
10
10
|
up: async (queryInterface, Sequelize) => {
|
|
11
11
|
await queryInterface.sequelize.transaction(async transaction => {
|
|
12
|
-
await queryInterface.removeIndex(table, `${table}
|
|
13
|
-
|
|
12
|
+
await queryInterface.removeIndex(table, `${table}_template_id`, { transaction });
|
|
14
13
|
await queryInterface.addIndex(table, {
|
|
15
14
|
name: `${table}_templateId_archived`,
|
|
16
15
|
fields: ['templateId', 'archived'],
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/* eslint-disable new-cap */
|
|
2
|
+
|
|
3
|
+
'use strict';
|
|
4
|
+
|
|
5
|
+
const prefix = process.env.DATASTORE_SEQUELIZE_PREFIX || '';
|
|
6
|
+
const table = `${prefix}pipelines`;
|
|
7
|
+
|
|
8
|
+
module.exports = {
|
|
9
|
+
up: async (queryInterface, Sequelize) => {
|
|
10
|
+
await queryInterface.sequelize.transaction(async transaction => {
|
|
11
|
+
await queryInterface.addColumn(
|
|
12
|
+
table,
|
|
13
|
+
'stateChanger',
|
|
14
|
+
{
|
|
15
|
+
type: Sequelize.STRING(128)
|
|
16
|
+
},
|
|
17
|
+
{ transaction }
|
|
18
|
+
);
|
|
19
|
+
await queryInterface.addColumn(
|
|
20
|
+
table,
|
|
21
|
+
'stateChangeTime',
|
|
22
|
+
{
|
|
23
|
+
type: Sequelize.STRING(32)
|
|
24
|
+
},
|
|
25
|
+
{ transaction }
|
|
26
|
+
);
|
|
27
|
+
await queryInterface.addColumn(
|
|
28
|
+
table,
|
|
29
|
+
'stateChangeMessage',
|
|
30
|
+
{
|
|
31
|
+
type: Sequelize.STRING(512)
|
|
32
|
+
},
|
|
33
|
+
{ transaction }
|
|
34
|
+
);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
};
|
package/models/pipeline.js
CHANGED
|
@@ -10,7 +10,8 @@ const WorkflowGraph = require('../config/workflowGraph');
|
|
|
10
10
|
const Parameters = require('../config/parameters');
|
|
11
11
|
const mutate = require('../lib/mutate');
|
|
12
12
|
|
|
13
|
-
const STATES = ['ACTIVE', 'INACTIVE', 'DELETING'];
|
|
13
|
+
const STATES = ['ACTIVE', 'INACTIVE', 'DELETING', 'DISABLED'];
|
|
14
|
+
const VALID_STATES_FOR_UPDATE = ['ACTIVE', 'DISABLED'];
|
|
14
15
|
const BADGE = Joi.object({
|
|
15
16
|
defaultName: Joi.string()
|
|
16
17
|
.max(128)
|
|
@@ -107,6 +108,15 @@ const MODEL = {
|
|
|
107
108
|
.default('ACTIVE')
|
|
108
109
|
.required(),
|
|
109
110
|
|
|
111
|
+
stateChanger: Joi.string().max(128).description('Username for who changed the state'),
|
|
112
|
+
|
|
113
|
+
stateChangeTime: Joi.string().isoDate().description('When the state of the pipeline was changed'),
|
|
114
|
+
|
|
115
|
+
stateChangeMessage: Joi.string()
|
|
116
|
+
.max(512)
|
|
117
|
+
.description('Reason why disabling or enabling pipeline')
|
|
118
|
+
.example('Disabling pipeline for maintenance'),
|
|
119
|
+
|
|
110
120
|
subscribedScmUrlsWithActions: Joi.array()
|
|
111
121
|
.items(
|
|
112
122
|
Joi.object().keys({
|
|
@@ -132,7 +142,18 @@ const MODEL = {
|
|
|
132
142
|
.allow(null)
|
|
133
143
|
};
|
|
134
144
|
|
|
135
|
-
const UPDATE_MODEL = {
|
|
145
|
+
const UPDATE_MODEL = {
|
|
146
|
+
...CREATE_MODEL,
|
|
147
|
+
settings: MODEL.settings,
|
|
148
|
+
badges: MODEL.badges,
|
|
149
|
+
state: Joi.string()
|
|
150
|
+
.valid(...VALID_STATES_FOR_UPDATE)
|
|
151
|
+
.max(10)
|
|
152
|
+
.description('New state of the pipeline')
|
|
153
|
+
.example('ACTIVE')
|
|
154
|
+
.optional(),
|
|
155
|
+
stateChangeMessage: MODEL.stateChangeMessage
|
|
156
|
+
};
|
|
136
157
|
|
|
137
158
|
module.exports = {
|
|
138
159
|
/**
|
|
@@ -175,7 +196,10 @@ module.exports = {
|
|
|
175
196
|
'settings',
|
|
176
197
|
'badges',
|
|
177
198
|
'templateVersionId',
|
|
178
|
-
'adminUserIds'
|
|
199
|
+
'adminUserIds',
|
|
200
|
+
'stateChanger',
|
|
201
|
+
'stateChangeTime',
|
|
202
|
+
'stateChangeMessage'
|
|
179
203
|
]
|
|
180
204
|
)
|
|
181
205
|
).label('Get Pipeline'),
|
|
@@ -197,7 +221,11 @@ module.exports = {
|
|
|
197
221
|
* @type {Joi}
|
|
198
222
|
*/
|
|
199
223
|
update: Joi.object(
|
|
200
|
-
mutate(
|
|
224
|
+
mutate(
|
|
225
|
+
UPDATE_MODEL,
|
|
226
|
+
[],
|
|
227
|
+
['checkoutUrl', 'rootDir', 'autoKeysGeneration', 'settings', 'badges', 'state', 'stateChangeMessage']
|
|
228
|
+
)
|
|
201
229
|
).label('Update Pipeline'),
|
|
202
230
|
|
|
203
231
|
/**
|