mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Added new meta columns to tags table
no-issue This prepares the database for future work, allowing tags to store metadata
This commit is contained in:
parent
60940253ad
commit
a607610c3a
3 changed files with 108 additions and 1 deletions
|
@ -0,0 +1,97 @@
|
|||
const commands = require('../../../schema').commands;
|
||||
|
||||
const newColumns = [{
|
||||
column: 'og_image',
|
||||
columnDefinition: {
|
||||
type: 'string',
|
||||
maxlength: 2000,
|
||||
nullable: true
|
||||
}
|
||||
}, {
|
||||
column: 'og_title',
|
||||
columnDefinition: {
|
||||
type: 'string',
|
||||
maxlength: 300,
|
||||
nullable: true
|
||||
}
|
||||
}, {
|
||||
column: 'og_description',
|
||||
columnDefinition: {
|
||||
type: 'string',
|
||||
maxlength: 500,
|
||||
nullable: true
|
||||
}
|
||||
}, {
|
||||
column: 'twitter_image',
|
||||
columnDefinition: {
|
||||
type: 'string',
|
||||
maxlength: 2000,
|
||||
nullable: true
|
||||
}
|
||||
}, {
|
||||
column: 'twitter_title',
|
||||
columnDefinition: {
|
||||
type: 'string',
|
||||
maxlength: 300,
|
||||
nullable: true
|
||||
}
|
||||
}, {
|
||||
column: 'twitter_description',
|
||||
columnDefinition: {
|
||||
type: 'string',
|
||||
maxlength: 500,
|
||||
nullable: true
|
||||
}
|
||||
}, {
|
||||
column: 'codeinjection_head',
|
||||
columnDefinition: {
|
||||
type: 'text',
|
||||
maxlength: 65535,
|
||||
nullable: true
|
||||
}
|
||||
}, {
|
||||
column: 'codeinjection_foot',
|
||||
columnDefinition: {
|
||||
type: 'text',
|
||||
maxlength: 65535,
|
||||
nullable: true
|
||||
}
|
||||
}, {
|
||||
column: 'canonical_url',
|
||||
columnDefinition: {
|
||||
type: 'string',
|
||||
maxlength: 2000,
|
||||
nullable: true
|
||||
}
|
||||
}, {
|
||||
column: 'accent_color',
|
||||
columnDefinition: {
|
||||
type: 'string',
|
||||
maxlength: 50,
|
||||
nullable: true
|
||||
}
|
||||
}];
|
||||
|
||||
module.exports = {
|
||||
config: {
|
||||
transaction: true
|
||||
},
|
||||
|
||||
up: commands.createColumnMigration(...newColumns.map((column) => {
|
||||
return Object.assign({}, column, {
|
||||
table: 'tags',
|
||||
dbIsInCorrectState: hasColumn => hasColumn === true,
|
||||
operation: commands.addColumn,
|
||||
operationVerb: 'Adding'
|
||||
});
|
||||
})),
|
||||
|
||||
down: commands.createColumnMigration(...newColumns.map((column) => {
|
||||
return Object.assign({}, column, {
|
||||
table: 'tags',
|
||||
dbIsInCorrectState: hasColumn => hasColumn === false,
|
||||
operation: commands.dropColumn,
|
||||
operationVerb: 'Removing'
|
||||
});
|
||||
}))
|
||||
};
|
|
@ -205,8 +205,18 @@ module.exports = {
|
|||
defaultTo: 'public',
|
||||
validations: {isIn: [['public', 'internal']]}
|
||||
},
|
||||
og_image: {type: 'string', maxlength: 2000, nullable: true},
|
||||
og_title: {type: 'string', maxlength: 300, nullable: true},
|
||||
og_description: {type: 'string', maxlength: 500, nullable: true},
|
||||
twitter_image: {type: 'string', maxlength: 2000, nullable: true},
|
||||
twitter_title: {type: 'string', maxlength: 300, nullable: true},
|
||||
twitter_description: {type: 'string', maxlength: 500, nullable: true},
|
||||
meta_title: {type: 'string', maxlength: 2000, nullable: true, validations: {isLength: {max: 300}}},
|
||||
meta_description: {type: 'string', maxlength: 2000, nullable: true, validations: {isLength: {max: 500}}},
|
||||
codeinjection_head: {type: 'text', maxlength: 65535, nullable: true},
|
||||
codeinjection_foot: {type: 'text', maxlength: 65535, nullable: true},
|
||||
canonical_url: {type: 'string', maxlength: 2000, nullable: true},
|
||||
accent_color: {type: 'string', maxlength: 50, nullable: true},
|
||||
created_at: {type: 'dateTime', nullable: false},
|
||||
created_by: {type: 'string', maxlength: 24, nullable: false},
|
||||
updated_at: {type: 'dateTime', nullable: true},
|
||||
|
|
|
@ -19,7 +19,7 @@ const fixtures = require('../../../../core/server/data/schema/fixtures');
|
|||
*/
|
||||
describe('DB version integrity', function () {
|
||||
// Only these variables should need updating
|
||||
const currentSchemaHash = '74b599e66e9d28c591cb7a3d9ec528cf';
|
||||
const currentSchemaHash = '134c9de4e59b31ec6b73f03638a01396';
|
||||
const currentFixturesHash = '3d942c46e8487c4aee1e9ac898ed29ca';
|
||||
|
||||
// If this test is failing, then it is likely a change has been made that requires a DB version bump,
|
||||
|
|
Loading…
Add table
Reference in a new issue