mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Data model additions for post tags, custom data and uploads
closes #171, closes #314, closes #315 - added settings for blog logo and icon - all other settings will need to be added as needed as it's impossible to guess what the default value should be - added tables for post tags - added tables for post custom data - added location column to users - fixeed minor bug in migrations
This commit is contained in:
parent
9393a956f4
commit
2a5e7ad516
3 changed files with 81 additions and 7 deletions
|
@ -11,7 +11,24 @@ module.exports = {
|
|||
"created_by": 1,
|
||||
"updated_by": 1,
|
||||
"type": "core"
|
||||
},
|
||||
{
|
||||
"uuid": uuid.v4(),
|
||||
"key": "logo",
|
||||
"value": "",
|
||||
"created_by": 1,
|
||||
"updated_by": 1,
|
||||
"type": "blog"
|
||||
},
|
||||
{
|
||||
"uuid": uuid.v4(),
|
||||
"key": "icon",
|
||||
"value": "",
|
||||
"created_by": 1,
|
||||
"updated_by": 1,
|
||||
"type": "blog"
|
||||
}
|
||||
|
||||
],
|
||||
|
||||
roles: [],
|
||||
|
|
|
@ -10,17 +10,58 @@ up = function () {
|
|||
|
||||
return when.all([
|
||||
|
||||
// TODO: Create tables or modify tables in this general area
|
||||
knex.Schema.createTable('tags', function (t) {
|
||||
t.increments().primary();
|
||||
t.string('uuid');
|
||||
t.string('name');
|
||||
t.string('slug');
|
||||
t.text('descripton');
|
||||
t.integer('parent_id').nullable();
|
||||
t.string('meta_title');
|
||||
t.text('meta_description');
|
||||
t.string('meta_keywords');
|
||||
t.dateTime('created_at');
|
||||
t.integer('created_by');
|
||||
t.dateTime('updated_at').nullable();
|
||||
t.integer('updated_by').nullable();
|
||||
}),
|
||||
knex.Schema.createTable('posts_tags', function (t) {
|
||||
t.increments().primary();
|
||||
t.string('uuid');
|
||||
t.integer('post_id');
|
||||
t.integer('tag_id');
|
||||
}),
|
||||
knex.Schema.createTable('custom_data', function (t) {
|
||||
t.increments().primary();
|
||||
t.string('uuid');
|
||||
t.string('name');
|
||||
t.string('slug');
|
||||
t.text('value');
|
||||
t.string('type').defaultTo('html');
|
||||
t.string('owner').defaultTo('Ghost');
|
||||
t.string('meta_title');
|
||||
t.text('meta_description');
|
||||
t.string('meta_keywords');
|
||||
t.dateTime('created_at');
|
||||
t.integer('created_by');
|
||||
t.dateTime('updated_at').nullable();
|
||||
t.integer('updated_by').nullable();
|
||||
}),
|
||||
knex.Schema.createTable('posts_custom_data', function (t) {
|
||||
t.increments().primary();
|
||||
t.string('uuid');
|
||||
t.integer('post_id');
|
||||
t.integer('custom_data_id');
|
||||
}),
|
||||
knex.Schema.table('users', function (t) {
|
||||
t.string('location').after('bio');
|
||||
})
|
||||
|
||||
]).then(function () {
|
||||
|
||||
// Once we create all of the initial tables, bootstrap any of the data
|
||||
|
||||
return when.all([
|
||||
//knex('posts').insert(fixtures.posts),
|
||||
//knex('roles').insert(fixtures.roles),
|
||||
//knex('permissions').insert(fixtures.permissions),
|
||||
//knex('permissions_roles').insert(fixtures.permissions_roles),
|
||||
knex('settings').insert(fixtures.settings)
|
||||
]);
|
||||
|
||||
|
@ -34,7 +75,16 @@ up = function () {
|
|||
};
|
||||
|
||||
down = function () {
|
||||
return;
|
||||
return when.all([
|
||||
knex.Schema.dropTableIfExists("tags"),
|
||||
knex.Schema.dropTableIfExists("custom_data")
|
||||
]).then(function () {
|
||||
// Drop the relation tables after the model tables?
|
||||
return when.all([
|
||||
knex.Schema.dropTableIfExists("posts_tags"),
|
||||
knex.Schema.dropTableIfExists("posts_custom_data")
|
||||
]);
|
||||
});
|
||||
};
|
||||
|
||||
exports.up = up;
|
||||
|
|
|
@ -20,7 +20,14 @@ module.exports = {
|
|||
.where('key', 'currentVersion')
|
||||
.select('value')
|
||||
.then(function (currentVersionSetting) {
|
||||
// We are assuming here that the currentVersionSetting will
|
||||
if (currentVersionSetting && currentVersionSetting.length > 0) {
|
||||
currentVersionSetting = currentVersionSetting[0].value;
|
||||
} else {
|
||||
// we didn't get a response we understood, assume initialVersion
|
||||
currentVersionSetting = initialVersion;
|
||||
}
|
||||
|
||||
// We are assuming here that the currentVersionSetting will
|
||||
// always be less than the currentVersion value.
|
||||
if (currentVersionSetting === currentVersion) {
|
||||
return when.resolve();
|
||||
|
|
Loading…
Add table
Reference in a new issue