mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 11:55:03 +03:00
🏗 Added jobs table creation migration
refs https://github.com/TryGhost/Toolbox/issues/357 - One time jobs need a storage mechanism to be run only ever once. - Field notes: - `id`, `created_at`, `updated_at` - standard Ghost fields - `name` - unique name of the job, could also be used with prefixing to identify certain type of job (e.g.: backup-bob-2022-10-16, backup-sam-2023-01-13 identifying backup jobs run by users) - `status` - 'started' | 'finished' | 'failed' | 'queued' (need to identify when the job is in progress, done, added to the execution queue, or errored) - `started_at` - when the job started execution - `finished_at` - when the job successfully finished execution
This commit is contained in:
parent
cff4772d50
commit
c667620d8f
@ -34,7 +34,8 @@ const BACKUP_TABLES = [
|
||||
'members_newsletters',
|
||||
'comments',
|
||||
'comment_likes',
|
||||
'comment_reports'
|
||||
'comment_reports',
|
||||
'jobs'
|
||||
];
|
||||
|
||||
// NOTE: exposing only tables which are going to be included in a "default" export file
|
||||
|
@ -0,0 +1,11 @@
|
||||
const {addTable} = require('../../utils');
|
||||
|
||||
module.exports = addTable('jobs', {
|
||||
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
|
||||
name: {type: 'string', maxlength: 191, nullable: false, unique: true},
|
||||
status: {type: 'string', maxlength: 50, nullable: false, defaultTo: 'queued', validations: {isIn: [['started', 'finished', 'failed', 'queued']]}},
|
||||
started_at: {type: 'dateTime', nullable: true},
|
||||
finished_at: {type: 'dateTime', nullable: true},
|
||||
created_at: {type: 'dateTime', nullable: false},
|
||||
updated_at: {type: 'dateTime', nullable: true}
|
||||
});
|
@ -771,5 +771,14 @@ module.exports = {
|
||||
member_id: {type: 'string', maxlength: 24, nullable: true, unique: false, references: 'members.id', setNullDelete: true},
|
||||
created_at: {type: 'dateTime', nullable: false},
|
||||
updated_at: {type: 'dateTime', nullable: false}
|
||||
},
|
||||
jobs: {
|
||||
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
|
||||
name: {type: 'string', maxlength: 191, nullable: false, unique: true},
|
||||
status: {type: 'string', maxlength: 50, nullable: false, defaultTo: 'queued', validations: {isIn: [['started', 'finished', 'failed', 'queued']]}},
|
||||
started_at: {type: 'dateTime', nullable: true},
|
||||
finished_at: {type: 'dateTime', nullable: true},
|
||||
created_at: {type: 'dateTime', nullable: false},
|
||||
updated_at: {type: 'dateTime', nullable: true}
|
||||
}
|
||||
};
|
||||
|
@ -34,6 +34,7 @@ describe('Exporter', function () {
|
||||
'emails',
|
||||
'integrations',
|
||||
'invites',
|
||||
'jobs',
|
||||
'labels',
|
||||
'members',
|
||||
'members_cancel_events',
|
||||
|
@ -35,7 +35,7 @@ const validateRouteSettings = require('../../../../../core/server/services/route
|
||||
*/
|
||||
describe('DB version integrity', function () {
|
||||
// Only these variables should need updating
|
||||
const currentSchemaHash = '6ca68654d9dcb05cf054b0a74f0de2c7';
|
||||
const currentSchemaHash = '71daf7814834fffd40abba86a92f4347';
|
||||
const currentFixturesHash = 'a42105cc0d47dd978dd52ee271340013';
|
||||
const currentSettingsHash = 'd54210758b7054e2174fd34aa2320ad7';
|
||||
const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01';
|
||||
|
Loading…
Reference in New Issue
Block a user