0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:36:14 -05:00

🏗 Dropped apps related tables

refs https://github.com/TryGhost/Ghost/issues/12565

- Dropped apps_* tables which were not used since the concept of "apps" has been abandoned
- Uses newly introduced "dropTables" migration utility
- Review for these changes has been completed in
(https://github.com/TryGhost/Ghost/pull/12592)
This commit is contained in:
Naz 2021-02-02 14:58:48 +13:00
parent a676ef19e8
commit 606212d187
5 changed files with 20 additions and 58 deletions

View file

@ -0,0 +1,10 @@
const {dropTables} = require('../../utils');
const tables = [
'permissions_apps',
'app_fields',
'app_settings',
'apps'
];
module.exports = dropTables(tables);

View file

@ -144,11 +144,6 @@ module.exports = {
role_id: {type: 'string', maxlength: 24, nullable: false},
permission_id: {type: 'string', maxlength: 24, nullable: false}
},
permissions_apps: {
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
app_id: {type: 'string', maxlength: 24, nullable: false},
permission_id: {type: 'string', maxlength: 24, nullable: false}
},
settings: {
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
group: {
@ -233,41 +228,6 @@ module.exports = {
tag_id: {type: 'string', maxlength: 24, nullable: false, references: 'tags.id'},
sort_order: {type: 'integer', nullable: false, unsigned: true, defaultTo: 0}
},
apps: {
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
name: {type: 'string', maxlength: 191, nullable: false, unique: true},
slug: {type: 'string', maxlength: 191, nullable: false, unique: true},
version: {type: 'string', maxlength: 50, nullable: false},
status: {type: 'string', maxlength: 50, nullable: false, defaultTo: 'inactive'},
created_at: {type: 'dateTime', nullable: false},
created_by: {type: 'string', maxlength: 24, nullable: false},
updated_at: {type: 'dateTime', nullable: true},
updated_by: {type: 'string', maxlength: 24, nullable: true}
},
app_settings: {
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
key: {type: 'string', maxlength: 50, nullable: false, unique: true},
value: {type: 'text', maxlength: 65535, nullable: true},
app_id: {type: 'string', maxlength: 24, nullable: false, references: 'apps.id'},
created_at: {type: 'dateTime', nullable: false},
created_by: {type: 'string', maxlength: 24, nullable: false},
updated_at: {type: 'dateTime', nullable: true},
updated_by: {type: 'string', maxlength: 24, nullable: true}
},
app_fields: {
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
key: {type: 'string', maxlength: 50, nullable: false},
value: {type: 'text', maxlength: 65535, nullable: true},
type: {type: 'string', maxlength: 50, nullable: false, defaultTo: 'html'},
app_id: {type: 'string', maxlength: 24, nullable: false, references: 'apps.id'},
relatable_id: {type: 'string', maxlength: 24, nullable: false},
relatable_type: {type: 'string', maxlength: 50, nullable: false, defaultTo: 'posts'},
active: {type: 'bool', nullable: false, defaultTo: true},
created_at: {type: 'dateTime', nullable: false},
created_by: {type: 'string', maxlength: 24, nullable: false},
updated_at: {type: 'dateTime', nullable: true},
updated_by: {type: 'string', maxlength: 24, nullable: true}
},
invites: {
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
role_id: {type: 'string', maxlength: 24, nullable: false},

View file

@ -47,7 +47,7 @@ describe('DB API', function () {
const jsonResponse = res.body;
should.exist(jsonResponse.db);
jsonResponse.db.should.have.length(1);
Object.keys(jsonResponse.db[0].data).length.should.eql(32);
Object.keys(jsonResponse.db[0].data).length.should.eql(28);
});
it('Can import a JSON database', async function () {

View file

@ -68,13 +68,9 @@ describe('Exporter', function () {
knexMock.getCall(6).args[0].should.eql('permissions');
knexMock.getCall(7).args[0].should.eql('permissions_users');
knexMock.getCall(8).args[0].should.eql('permissions_roles');
knexMock.getCall(9).args[0].should.eql('permissions_apps');
knexMock.getCall(10).args[0].should.eql('settings');
knexMock.getCall(11).args[0].should.eql('tags');
knexMock.getCall(12).args[0].should.eql('posts_tags');
knexMock.getCall(13).args[0].should.eql('apps');
knexMock.getCall(14).args[0].should.eql('app_settings');
knexMock.getCall(15).args[0].should.eql('app_fields');
knexMock.getCall(9).args[0].should.eql('settings');
knexMock.getCall(10).args[0].should.eql('tags');
knexMock.getCall(11).args[0].should.eql('posts_tags');
done();
}).catch(done);
@ -110,15 +106,11 @@ describe('Exporter', function () {
knexMock.getCall(6).args[0].should.eql('permissions');
knexMock.getCall(7).args[0].should.eql('permissions_users');
knexMock.getCall(8).args[0].should.eql('permissions_roles');
knexMock.getCall(9).args[0].should.eql('permissions_apps');
knexMock.getCall(10).args[0].should.eql('settings');
knexMock.getCall(11).args[0].should.eql('tags');
knexMock.getCall(12).args[0].should.eql('posts_tags');
knexMock.getCall(13).args[0].should.eql('apps');
knexMock.getCall(14).args[0].should.eql('app_settings');
knexMock.getCall(15).args[0].should.eql('app_fields');
knexMock.getCall(16).args[0].should.eql('clients');
knexMock.getCall(17).args[0].should.eql('client_trusted_domains');
knexMock.getCall(9).args[0].should.eql('settings');
knexMock.getCall(10).args[0].should.eql('tags');
knexMock.getCall(11).args[0].should.eql('posts_tags');
knexMock.getCall(12).args[0].should.eql('clients');
knexMock.getCall(13).args[0].should.eql('client_trusted_domains');
done();
}).catch(done);

View file

@ -32,7 +32,7 @@ const defaultSettings = require('../../../../core/server/data/schema/default-set
*/
describe('DB version integrity', function () {
// Only these variables should need updating
const currentSchemaHash = 'deabc97adf47f5c6d086eaf4e3172f1d';
const currentSchemaHash = '0970e14fcf8d91daaf636da382e3da29';
const currentFixturesHash = '370d0da0ab7c45050b2ff30bce8896ba';
const currentSettingsHash = '162f9294cc427eb32bc0577006c385ce';
const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01';