Skip to content

Commit

Permalink
🏗️ Added meta fields to collections table
Browse files Browse the repository at this point in the history
closes https://github.com/TryGhost/Arch/issues/19

- Adds "meta" fields similarly to the ones in "tags" table. We need these fields in collections as collections as a resource will be routable page - should be able to have customizable meta fields for the meta HTML headers and some extras like "accent_color"
  • Loading branch information
naz committed Aug 21, 2023
1 parent 49a4a60 commit 7aabfb5
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
const {combineNonTransactionalMigrations, createAddColumnMigration} = require('../../utils');

module.exports = combineNonTransactionalMigrations(
createAddColumnMigration('collections', 'og_image', {
type: 'string',
maxlength: 2000,
nullable: true
}),
createAddColumnMigration('collections', 'og_title', {
type: 'string',
maxlength: 300,
nullable: true
}),
createAddColumnMigration('collections', 'og_description', {
type: 'string',
maxlength: 500,
nullable: true
}),
createAddColumnMigration('collections', 'twitter_image', {
type: 'string',
maxlength: 2000,
nullable: true
}),
createAddColumnMigration('collections', 'twitter_title', {
type: 'string',
maxlength: 300,
nullable: true
}),
createAddColumnMigration('collections', 'twitter_description', {
type: 'string',
maxlength: 500,
nullable: true
}),
createAddColumnMigration('collections', 'meta_title', {
type: 'string',
maxlength: 2000,
nullable: true,
validations: {
isLength: {
max: 300
}
}
}),
createAddColumnMigration('collections', 'meta_description', {
type: 'string',
maxlength: 2000,
nullable: true,
validations: {
isLength: {
max: 500
}
}
}),
createAddColumnMigration('collections', 'codeinjection_head', {
type: 'text',
maxlength: 65535,
nullable: true
}),
createAddColumnMigration('collections', 'codeinjection_foot', {
type: 'text',
maxlength: 65535,
nullable: true
}),
createAddColumnMigration('collections', 'canonical_url', {
type: 'string',
maxlength: 2000,
nullable: true
}),
createAddColumnMigration('collections', 'accent_color', {
type: 'string',
maxlength: 50,
nullable: true
})
);

12 changes: 12 additions & 0 deletions ghost/core/core/server/data/schema/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -1059,6 +1059,18 @@ module.exports = {
type: {type: 'string', maxlength: 50, nullable: false},
filter: {type: 'text', maxlength: 1000000000, nullable: true},
feature_image: {type: 'string', maxlength: 2000, nullable: true},
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},
updated_at: {type: 'dateTime', nullable: true}
},
Expand Down
2 changes: 1 addition & 1 deletion ghost/core/test/unit/server/data/schema/integrity.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const validateRouteSettings = require('../../../../../core/server/services/route
*/
describe('DB version integrity', function () {
// Only these variables should need updating
const currentSchemaHash = 'ad44bf95fee71a878704bff2a313a583';
const currentSchemaHash = '092ae8a5146ff101cc24761731fdb712';
const currentFixturesHash = '1803057343a6afa7b50f1dabbc21424d';
const currentSettingsHash = 'dd0e318627ded65e41f188fb5bdf5b74';
const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01';
Expand Down

0 comments on commit 7aabfb5

Please sign in to comment.