Skip to content

Commit

Permalink
Add the needed table columns for client Oauth.
Browse files Browse the repository at this point in the history
closes #4174
- Added columns to client table in schema.js
- Bumped database version in default-settings.json
- Updated tests to support new schema version
  • Loading branch information
sgoodwin authored and ErisDS committed Sep 2, 2015
1 parent 5c3fc55 commit 48601e6
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 17 deletions.
2 changes: 1 addition & 1 deletion core/server/data/default-settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"core": {
"databaseVersion": {
"defaultValue": "003"
"defaultValue": "004"
},
"dbHash": {
"defaultValue": null
Expand Down
5 changes: 5 additions & 0 deletions core/server/data/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,11 @@ var db = {
name: {type: 'string', maxlength: 150, nullable: false, unique: true},
slug: {type: 'string', maxlength: 150, nullable: false, unique: true},
secret: {type: 'string', maxlength: 150, nullable: false, unique: true},
redirection_uri: {type: 'string', maxlength: 2000, nullable: true},
logo: {type: 'string', maxlength: 2000, nullable: true},
status: {type: 'string', maxlength: 150, nullable: false, defaultTo: 'development'},
type: {type: 'string', maxlength: 150, nullable: false, defaultTo: 'Client-Side'},
description: {type: 'string', maxlength: 200, nullable: true},
created_at: {type: 'dateTime', nullable: false},
created_by: {type: 'integer', nullable: false},
updated_at: {type: 'dateTime', nullable: true},
Expand Down
6 changes: 3 additions & 3 deletions core/test/integration/export_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('Exporter', function () {
it('exports data', function (done) {
// Stub migrations to return 000 as the current database version
var versioningStub = sandbox.stub(versioning, 'getDatabaseVersion', function () {
return Promise.resolve('003');
return Promise.resolve('004');
});

exporter().then(function (exportData) {
Expand All @@ -37,13 +37,13 @@ describe('Exporter', function () {
should.exist(exportData.meta);
should.exist(exportData.data);

exportData.meta.version.should.equal('003');
exportData.meta.version.should.equal('004');

dbVersionSetting = _.findWhere(exportData.data.settings, {key: 'databaseVersion'});

should.exist(dbVersionSetting);

dbVersionSetting.value.should.equal('003');
dbVersionSetting.value.should.equal('004');

_.each(tables, function (name) {
should.exist(exportData.data[name]);
Expand Down
22 changes: 11 additions & 11 deletions core/test/integration/import_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ describe('Import', function () {

// test settings
settings.length.should.be.above(0, 'Wrong number of settings');
_.findWhere(settings, {key: 'databaseVersion'}).value.should.equal('003', 'Wrong database version');
_.findWhere(settings, {key: 'databaseVersion'}).value.should.equal('004', 'Wrong database version');

// test tags
tags.length.should.equal(exportData.data.tags.length, 'no new tags');
Expand Down Expand Up @@ -210,7 +210,7 @@ describe('Import', function () {

// test settings
settings.length.should.be.above(0, 'Wrong number of settings');
_.findWhere(settings, {key: 'databaseVersion'}).value.should.equal('003', 'Wrong database version');
_.findWhere(settings, {key: 'databaseVersion'}).value.should.equal('004', 'Wrong database version');

// activeTheme should NOT have been overridden
_.findWhere(settings, {key: 'activeTheme'}).value.should.equal('casper', 'Wrong theme');
Expand Down Expand Up @@ -271,7 +271,7 @@ describe('Import', function () {

// test settings
settings.length.should.be.above(0, 'Wrong number of settings');
_.findWhere(settings, {key: 'databaseVersion'}).value.should.equal('003', 'Wrong database version');
_.findWhere(settings, {key: 'databaseVersion'}).value.should.equal('004', 'Wrong database version');

done();
});
Expand Down Expand Up @@ -316,7 +316,7 @@ describe('Import', function () {

// test settings
settings.length.should.be.above(0, 'Wrong number of settings');
_.findWhere(settings, {key: 'databaseVersion'}).value.should.equal('003', 'Wrong database version');
_.findWhere(settings, {key: 'databaseVersion'}).value.should.equal('004', 'Wrong database version');

done();
});
Expand Down Expand Up @@ -374,7 +374,7 @@ describe('Import', function () {

// test settings
settings.length.should.be.above(0, 'Wrong number of settings');
_.findWhere(settings, {key: 'databaseVersion'}).value.should.equal('003', 'Wrong database version');
_.findWhere(settings, {key: 'databaseVersion'}).value.should.equal('004', 'Wrong database version');

// activeTheme should NOT have been overridden
_.findWhere(settings, {key: 'activeTheme'}).value.should.equal('casper', 'Wrong theme');
Expand Down Expand Up @@ -434,7 +434,7 @@ describe('Import', function () {

// test settings
settings.length.should.be.above(0, 'Wrong number of settings');
_.findWhere(settings, {key: 'databaseVersion'}).value.should.equal('003', 'Wrong database version');
_.findWhere(settings, {key: 'databaseVersion'}).value.should.equal('004', 'Wrong database version');

done();
});
Expand Down Expand Up @@ -478,7 +478,7 @@ describe('Import', function () {

// test settings
settings.length.should.be.above(0, 'Wrong number of settings');
_.findWhere(settings, {key: 'databaseVersion'}).value.should.equal('003', 'Wrong database version');
_.findWhere(settings, {key: 'databaseVersion'}).value.should.equal('004', 'Wrong database version');

done();
});
Expand Down Expand Up @@ -528,7 +528,7 @@ describe('Import', function () {

// test settings
settings.length.should.be.above(0, 'Wrong number of settings');
_.findWhere(settings, {key: 'databaseVersion'}).value.should.equal('003', 'Wrong database version');
_.findWhere(settings, {key: 'databaseVersion'}).value.should.equal('004', 'Wrong database version');

done();
}).catch(done);
Expand Down Expand Up @@ -718,7 +718,7 @@ describe('Import (new test structure)', function () {

// test settings
settings.length.should.be.above(0, 'Wrong number of settings');
_.findWhere(settings, {key: 'databaseVersion'}).value.should.equal('003', 'Wrong database version');
_.findWhere(settings, {key: 'databaseVersion'}).value.should.equal('004', 'Wrong database version');

done();
}).catch(done);
Expand Down Expand Up @@ -943,7 +943,7 @@ describe('Import (new test structure)', function () {

// test settings
settings.length.should.be.above(0, 'Wrong number of settings');
_.findWhere(settings, {key: 'databaseVersion'}).value.should.equal('003', 'Wrong database version');
_.findWhere(settings, {key: 'databaseVersion'}).value.should.equal('004', 'Wrong database version');

done();
}).catch(done);
Expand Down Expand Up @@ -1180,7 +1180,7 @@ describe('Import (new test structure)', function () {

// test settings
settings.length.should.be.above(0, 'Wrong number of settings');
_.findWhere(settings, {key: 'databaseVersion'}).value.should.equal('003', 'Wrong database version');
_.findWhere(settings, {key: 'databaseVersion'}).value.should.equal('004', 'Wrong database version');

done();
}).catch(done);
Expand Down
4 changes: 2 additions & 2 deletions core/test/unit/migration_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ describe('Migrations', function () {

describe('DB version integrity', function () {
// Only these variables should need updating
var currentDbVersion = '003',
currentSchemaHash = '4f2a9e139f4c3dcf04e3006ea8ebba97',
var currentDbVersion = '004',
currentSchemaHash = 'a27a018a8aef272fd298b33552c2446b',
currentPermissionsHash = '42e486732270cda623fc5efc04808c0c';

// If this test is failing, then it is likely a change has been made that requires a DB version bump,
Expand Down

0 comments on commit 48601e6

Please sign in to comment.