mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
Add table columns for OAuth
closes #4174 - added trusted domains - removed unique constraint from secret
This commit is contained in:
parent
48601e6f49
commit
52e35a282b
4 changed files with 30 additions and 4 deletions
|
@ -161,17 +161,23 @@ var db = {
|
|||
uuid: {type: 'string', maxlength: 36, nullable: false},
|
||||
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},
|
||||
secret: {type: 'string', maxlength: 150, nullable: false},
|
||||
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'},
|
||||
type: {type: 'string', maxlength: 150, nullable: false, defaultTo: 'ua'},
|
||||
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},
|
||||
updated_by: {type: 'integer', nullable: true}
|
||||
},
|
||||
client_trusted_domains: {
|
||||
id: {type: 'increments', nullable: false, primary: true},
|
||||
uuid: {type: 'string', maxlength: 36, nullable: false},
|
||||
client_id: {type: 'integer', nullable: false, unsigned: true, references: 'clients.id'},
|
||||
trusted_domain: {type: 'string', maxlength: 2000, nullable: true}
|
||||
},
|
||||
accesstokens: {
|
||||
id: {type: 'increments', nullable: false, primary: true},
|
||||
token: {type: 'string', nullable: false, unique: true},
|
||||
|
|
17
core/server/models/client-trusted-domain.js
Normal file
17
core/server/models/client-trusted-domain.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
var ghostBookshelf = require('./base'),
|
||||
|
||||
ClientTrustedDomain,
|
||||
ClientTrustedDomains;
|
||||
|
||||
ClientTrustedDomain = ghostBookshelf.Model.extend({
|
||||
tableName: 'client_trusted_domains'
|
||||
});
|
||||
|
||||
ClientTrustedDomains = ghostBookshelf.Collection.extend({
|
||||
model: ClientTrustedDomain
|
||||
});
|
||||
|
||||
module.exports = {
|
||||
ClientTrustedDomain: ghostBookshelf.model('ClientTrustedDomain', ClientTrustedDomain),
|
||||
ClientTrustedDomains: ghostBookshelf.collection('ClientTrustedDomains', ClientTrustedDomains)
|
||||
};
|
|
@ -4,7 +4,10 @@ var ghostBookshelf = require('./base'),
|
|||
Clients;
|
||||
|
||||
Client = ghostBookshelf.Model.extend({
|
||||
tableName: 'clients'
|
||||
tableName: 'clients',
|
||||
trustedDomains: function trustedDomains() {
|
||||
return this.hasMany('ClientTrustedDomain', 'client_id');
|
||||
}
|
||||
});
|
||||
|
||||
Clients = ghostBookshelf.Collection.extend({
|
||||
|
|
|
@ -20,7 +20,7 @@ describe('Migrations', function () {
|
|||
describe('DB version integrity', function () {
|
||||
// Only these variables should need updating
|
||||
var currentDbVersion = '004',
|
||||
currentSchemaHash = 'a27a018a8aef272fd298b33552c2446b',
|
||||
currentSchemaHash = '45d72a3c103e36d9cde9f723a71287af',
|
||||
currentPermissionsHash = '42e486732270cda623fc5efc04808c0c';
|
||||
|
||||
// If this test is failing, then it is likely a change has been made that requires a DB version bump,
|
||||
|
|
Loading…
Reference in a new issue