Родитель
e62851e685
Коммит
0e39d1ee67
|
@ -36,8 +36,8 @@ function convertClientToConfigFormat(client) {
|
|||
for (var key in client) {
|
||||
if (key === 'createdAt') {
|
||||
continue;
|
||||
} else if (key === 'secret') {
|
||||
out.hashedSecret = unbuf(client.secret);
|
||||
} else if (key === 'hashedSecret') {
|
||||
out.hashedSecret = unbuf(client.hashedSecret);
|
||||
} else if (key === 'trusted' || key === 'canGrant') {
|
||||
out[key] = !!client[key]; // db stores booleans as 0 or 1.
|
||||
} else if (key === 'termsUri' || key === 'privacyUri') {
|
||||
|
|
|
@ -114,9 +114,9 @@ MysqlStore.connect = function mysqlConnect(options) {
|
|||
|
||||
const QUERY_CLIENT_REGISTER =
|
||||
'INSERT INTO clients ' +
|
||||
'(id, name, imageUri, hashedSecret, secret, redirectUri, termsUri,' +
|
||||
'(id, name, imageUri, hashedSecret, redirectUri, termsUri,' +
|
||||
'privacyUri, trusted, canGrant) ' +
|
||||
'VALUES (?,?, ?, ?, ?, ?, ?, ?, ?, ?);';
|
||||
'VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?);';
|
||||
const QUERY_CLIENT_DEVELOPER_INSERT =
|
||||
'INSERT INTO clientDevelopers ' +
|
||||
'(rowId, developerId, clientId) ' +
|
||||
|
@ -145,7 +145,6 @@ const QUERY_CLIENT_LIST = 'SELECT id, name, redirectUri, imageUri, ' +
|
|||
const QUERY_CLIENT_UPDATE = 'UPDATE clients SET ' +
|
||||
'name=COALESCE(?, name), imageUri=COALESCE(?, imageUri), ' +
|
||||
'hashedSecret=COALESCE(?, hashedSecret), ' +
|
||||
'secret=COALESCE(?, hashedSecret), ' +
|
||||
'redirectUri=COALESCE(?, redirectUri), ' +
|
||||
'termsUri=COALESCE(?, termsUri), privacyUri=COALESCE(?, privacyUri), ' +
|
||||
'trusted=COALESCE(?, trusted), canGrant=COALESCE(?, canGrant) ' +
|
||||
|
@ -215,7 +214,6 @@ MysqlStore.prototype = {
|
|||
client.name,
|
||||
client.imageUri || '',
|
||||
buf(client.hashedSecret),
|
||||
buf(client.hashedSecret), // duplicate for `secret` column until dropped
|
||||
client.redirectUri,
|
||||
client.termsUri || '',
|
||||
client.privacyUri || '',
|
||||
|
@ -311,7 +309,6 @@ MysqlStore.prototype = {
|
|||
client.name,
|
||||
client.imageUri,
|
||||
secret,
|
||||
secret, // duplicate for `secret` column until dropped
|
||||
client.redirectUri,
|
||||
client.termsUri,
|
||||
client.privacyUri,
|
||||
|
|
|
@ -6,4 +6,4 @@
|
|||
// Update this if you add a new patch, and don't forget to update
|
||||
// the documentation for the current schema in ../schema.sql.
|
||||
|
||||
module.exports.level = 9;
|
||||
module.exports.level = 10;
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
-- Remove `secret` column.
|
||||
|
||||
ALTER TABLE clients DROP COLUMN secret;
|
||||
|
||||
UPDATE dbMetadata SET value = '10' WHERE name = 'schema-patch-level';
|
|
@ -0,0 +1,6 @@
|
|||
-- (commented out to avoid accidentally running this in production...)
|
||||
|
||||
-- ALTER TABLE clients ADD COLUMN secret BINARY(32);
|
||||
-- UPDATE clients SET secret = hashedSecret;
|
||||
|
||||
-- UPDATE dbMetadata SET value = '9' WHERE name = 'schema-patch-level';
|
|
@ -10,7 +10,6 @@
|
|||
CREATE TABLE IF NOT EXISTS clients (
|
||||
id BINARY(8) PRIMARY KEY,
|
||||
hashedSecret BINARY(32),
|
||||
secret BINARY(32),
|
||||
name VARCHAR(256) NOT NULL,
|
||||
imageUri VARCHAR(256) NOT NULL,
|
||||
redirectUri VARCHAR(256) NOT NULL,
|
||||
|
|
Загрузка…
Ссылка в новой задаче