mirror of
https://github.com/ONLYOFFICE/server.git
synced 2026-02-10 18:05:07 +08:00
[feature] add dm8 database support
This commit is contained in:
committed by
Sergey Konovalov
parent
53853debfc
commit
57642c5ed0
@ -174,7 +174,8 @@
|
||||
"charset": "utf8",
|
||||
"connectionlimit": 10,
|
||||
"max_allowed_packet": 1048575,
|
||||
"pgPoolExtraOptions": {}
|
||||
"pgPoolExtraOptions": {},
|
||||
"damengExtraOptions": {}
|
||||
},
|
||||
"redis": {
|
||||
"name": "redis",
|
||||
|
||||
117
DocService/npm-shrinkwrap.json
generated
117
DocService/npm-shrinkwrap.json
generated
@ -4,6 +4,84 @@
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"@napi-rs/snappy-android-arm-eabi": {
|
||||
"version": "7.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/snappy-android-arm-eabi/-/snappy-android-arm-eabi-7.2.2.tgz",
|
||||
"integrity": "sha512-H7DuVkPCK5BlAr1NfSU8bDEN7gYs+R78pSHhDng83QxRnCLmVIZk33ymmIwurmoA1HrdTxbkbuNl+lMvNqnytw==",
|
||||
"optional": true
|
||||
},
|
||||
"@napi-rs/snappy-android-arm64": {
|
||||
"version": "7.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/snappy-android-arm64/-/snappy-android-arm64-7.2.2.tgz",
|
||||
"integrity": "sha512-2R/A3qok+nGtpVK8oUMcrIi5OMDckGYNoBLFyli3zp8w6IArPRfg1yOfVUcHvpUDTo9T7LOS1fXgMOoC796eQw==",
|
||||
"optional": true
|
||||
},
|
||||
"@napi-rs/snappy-darwin-arm64": {
|
||||
"version": "7.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/snappy-darwin-arm64/-/snappy-darwin-arm64-7.2.2.tgz",
|
||||
"integrity": "sha512-USgArHbfrmdbuq33bD5ssbkPIoT7YCXCRLmZpDS6dMDrx+iM7eD2BecNbOOo7/v1eu6TRmQ0xOzeQ6I/9FIi5g==",
|
||||
"optional": true
|
||||
},
|
||||
"@napi-rs/snappy-darwin-x64": {
|
||||
"version": "7.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/snappy-darwin-x64/-/snappy-darwin-x64-7.2.2.tgz",
|
||||
"integrity": "sha512-0APDu8iO5iT0IJKblk2lH0VpWSl9zOZndZKnBYIc+ei1npw2L5QvuErFOTeTdHBtzvUHASB+9bvgaWnQo4PvTQ==",
|
||||
"optional": true
|
||||
},
|
||||
"@napi-rs/snappy-freebsd-x64": {
|
||||
"version": "7.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/snappy-freebsd-x64/-/snappy-freebsd-x64-7.2.2.tgz",
|
||||
"integrity": "sha512-mRTCJsuzy0o/B0Hnp9CwNB5V6cOJ4wedDTWEthsdKHSsQlO7WU9W1yP7H3Qv3Ccp/ZfMyrmG98Ad7u7lG58WXA==",
|
||||
"optional": true
|
||||
},
|
||||
"@napi-rs/snappy-linux-arm-gnueabihf": {
|
||||
"version": "7.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/snappy-linux-arm-gnueabihf/-/snappy-linux-arm-gnueabihf-7.2.2.tgz",
|
||||
"integrity": "sha512-v1uzm8+6uYjasBPcFkv90VLZ+WhLzr/tnfkZ/iD9mHYiULqkqpRuC8zvc3FZaJy5wLQE9zTDkTJN1IvUcZ+Vcg==",
|
||||
"optional": true
|
||||
},
|
||||
"@napi-rs/snappy-linux-arm64-gnu": {
|
||||
"version": "7.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/snappy-linux-arm64-gnu/-/snappy-linux-arm64-gnu-7.2.2.tgz",
|
||||
"integrity": "sha512-LrEMa5pBScs4GXWOn6ZYXfQ72IzoolZw5txqUHVGs8eK4g1HR9HTHhb2oY5ySNaKakG5sOgMsb1rwaEnjhChmQ==",
|
||||
"optional": true
|
||||
},
|
||||
"@napi-rs/snappy-linux-arm64-musl": {
|
||||
"version": "7.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/snappy-linux-arm64-musl/-/snappy-linux-arm64-musl-7.2.2.tgz",
|
||||
"integrity": "sha512-3orWZo9hUpGQcB+3aTLW7UFDqNCQfbr0+MvV67x8nMNYj5eAeUtMmUE/HxLznHO4eZ1qSqiTwLbVx05/Socdlw==",
|
||||
"optional": true
|
||||
},
|
||||
"@napi-rs/snappy-linux-x64-gnu": {
|
||||
"version": "7.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/snappy-linux-x64-gnu/-/snappy-linux-x64-gnu-7.2.2.tgz",
|
||||
"integrity": "sha512-jZt8Jit/HHDcavt80zxEkDpH+R1Ic0ssiVCoueASzMXa7vwPJeF4ZxZyqUw4qeSy7n8UUExomu8G8ZbP6VKhgw==",
|
||||
"optional": true
|
||||
},
|
||||
"@napi-rs/snappy-linux-x64-musl": {
|
||||
"version": "7.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/snappy-linux-x64-musl/-/snappy-linux-x64-musl-7.2.2.tgz",
|
||||
"integrity": "sha512-Dh96IXgcZrV39a+Tej/owcd9vr5ihiZ3KRix11rr1v0MWtVb61+H1GXXlz6+Zcx9y8jM1NmOuiIuJwkV4vZ4WA==",
|
||||
"optional": true
|
||||
},
|
||||
"@napi-rs/snappy-win32-arm64-msvc": {
|
||||
"version": "7.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/snappy-win32-arm64-msvc/-/snappy-win32-arm64-msvc-7.2.2.tgz",
|
||||
"integrity": "sha512-9No0b3xGbHSWv2wtLEn3MO76Yopn1U2TdemZpCaEgOGccz1V+a/1d16Piz3ofSmnA13HGFz3h9NwZH9EOaIgYA==",
|
||||
"optional": true
|
||||
},
|
||||
"@napi-rs/snappy-win32-ia32-msvc": {
|
||||
"version": "7.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/snappy-win32-ia32-msvc/-/snappy-win32-ia32-msvc-7.2.2.tgz",
|
||||
"integrity": "sha512-QiGe+0G86J74Qz1JcHtBwM3OYdTni1hX1PFyLRo3HhQUSpmi13Bzc1En7APn+6Pvo7gkrcy81dObGLDSxFAkQQ==",
|
||||
"optional": true
|
||||
},
|
||||
"@napi-rs/snappy-win32-x64-msvc": {
|
||||
"version": "7.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@napi-rs/snappy-win32-x64-msvc/-/snappy-win32-x64-msvc-7.2.2.tgz",
|
||||
"integrity": "sha512-a43cyx1nK0daw6BZxVcvDEXxKMFLSBSDTAhsFD0VqSKcC7MGUBMaqyoWUcMiI7LBSz4bxUmxDWKfCYzpEmeb3w==",
|
||||
"optional": true
|
||||
},
|
||||
"@oozcitak/dom": {
|
||||
"version": "1.15.10",
|
||||
"resolved": "https://registry.npmjs.org/@oozcitak/dom/-/dom-1.15.10.tgz",
|
||||
@ -341,6 +419,25 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"dmdb": {
|
||||
"version": "1.0.14280",
|
||||
"resolved": "https://registry.npmjs.org/dmdb/-/dmdb-1.0.14280.tgz",
|
||||
"integrity": "sha512-vG6sA4s4Q3kLfO4RDTuA7b+//wNC/5ZEZk3MRHUtCqCcyMWoRaSZ8FWX60FFudaCoIi05kYGf8MlsMsy4HB6JA==",
|
||||
"requires": {
|
||||
"iconv-lite": "^0.5.1",
|
||||
"snappy": "^7.2.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"iconv-lite": {
|
||||
"version": "0.5.2",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.5.2.tgz",
|
||||
"integrity": "sha512-kERHXvpSaB4aU3eANwidg79K8FlrN77m8G9V+0vOR3HYaRifrlwMEpT7ZBJqLSEIHnEgJTHcWK82wwLwwKwtag==",
|
||||
"requires": {
|
||||
"safer-buffer": ">= 2.1.2 < 3"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"double-ended-queue": {
|
||||
"version": "2.1.0-0",
|
||||
"resolved": "https://registry.npmjs.org/double-ended-queue/-/double-ended-queue-2.1.0-0.tgz",
|
||||
@ -1237,6 +1334,26 @@
|
||||
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz",
|
||||
"integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ=="
|
||||
},
|
||||
"snappy": {
|
||||
"version": "7.2.2",
|
||||
"resolved": "https://registry.npmjs.org/snappy/-/snappy-7.2.2.tgz",
|
||||
"integrity": "sha512-iADMq1kY0v3vJmGTuKcFWSXt15qYUz7wFkArOrsSg0IFfI3nJqIJvK2/ZbEIndg7erIJLtAVX2nSOqPz7DcwbA==",
|
||||
"requires": {
|
||||
"@napi-rs/snappy-android-arm-eabi": "7.2.2",
|
||||
"@napi-rs/snappy-android-arm64": "7.2.2",
|
||||
"@napi-rs/snappy-darwin-arm64": "7.2.2",
|
||||
"@napi-rs/snappy-darwin-x64": "7.2.2",
|
||||
"@napi-rs/snappy-freebsd-x64": "7.2.2",
|
||||
"@napi-rs/snappy-linux-arm-gnueabihf": "7.2.2",
|
||||
"@napi-rs/snappy-linux-arm64-gnu": "7.2.2",
|
||||
"@napi-rs/snappy-linux-arm64-musl": "7.2.2",
|
||||
"@napi-rs/snappy-linux-x64-gnu": "7.2.2",
|
||||
"@napi-rs/snappy-linux-x64-musl": "7.2.2",
|
||||
"@napi-rs/snappy-win32-arm64-msvc": "7.2.2",
|
||||
"@napi-rs/snappy-win32-ia32-msvc": "7.2.2",
|
||||
"@napi-rs/snappy-win32-x64-msvc": "7.2.2"
|
||||
}
|
||||
},
|
||||
"socket.io": {
|
||||
"version": "4.5.2",
|
||||
"resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.5.2.tgz",
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
"config": "^2.0.1",
|
||||
"cron": "^1.5.0",
|
||||
"deep-equal": "^1.0.1",
|
||||
"dmdb": "^1.0.14280",
|
||||
"ejs": "~2.5.1",
|
||||
"express": "^4.17.1",
|
||||
"fakeredis": "^2.0.0",
|
||||
|
||||
@ -35,13 +35,27 @@
|
||||
var sqlDataBaseType = {
|
||||
mySql : 'mysql',
|
||||
mariaDB : 'mariadb',
|
||||
postgreSql : 'postgres'
|
||||
postgreSql : 'postgres',
|
||||
dameng : 'dameng'
|
||||
};
|
||||
|
||||
var bottleneck = require("bottleneck");
|
||||
var config = require('config');
|
||||
var configSql = config.get('services.CoAuthoring.sql');
|
||||
var baseConnector = (sqlDataBaseType.mySql === configSql.get('type') || sqlDataBaseType.mariaDB === configSql.get('type')) ? require('./mySqlBaseConnector') : require('./postgreSqlBaseConnector');
|
||||
|
||||
var baseConnector;
|
||||
switch (configSql.get('type')) {
|
||||
case sqlDataBaseType.mySql:
|
||||
case sqlDataBaseType.mariaDB:
|
||||
baseConnector = require('./mySqlBaseConnector');
|
||||
break;
|
||||
case sqlDataBaseType.dameng:
|
||||
baseConnector = require('./damengBaseConnector');
|
||||
break;
|
||||
default:
|
||||
baseConnector = require('./postgreSqlBaseConnector');
|
||||
break;
|
||||
}
|
||||
let constants = require('./../../Common/sources/constants');
|
||||
|
||||
const cfgTableResult = configSql.get('tableResult');
|
||||
@ -284,16 +298,20 @@ exports.getEmptyCallbacks = function(ctx) {
|
||||
});
|
||||
};
|
||||
exports.getTableColumns = function(ctx, tableName) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
const sqlCommand = `SELECT column_name FROM information_schema.COLUMNS WHERE TABLE_NAME = '${tableName}';`;
|
||||
baseConnector.sqlQuery(ctx, sqlCommand, function(error, result) {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
resolve(result);
|
||||
}
|
||||
if (baseConnector.getTableColumns) {
|
||||
return baseConnector.getTableColumns(ctx, tableName);
|
||||
} else {
|
||||
return new Promise(function(resolve, reject) {
|
||||
const sqlCommand = `SELECT column_name FROM information_schema.COLUMNS WHERE TABLE_NAME = '${tableName}';`;
|
||||
baseConnector.sqlQuery(ctx, sqlCommand, function(error, result) {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
resolve(result);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
function UserCallback() {
|
||||
this.userIndex = undefined;
|
||||
|
||||
204
DocService/sources/damengBaseConnector.js
Normal file
204
DocService/sources/damengBaseConnector.js
Normal file
@ -0,0 +1,204 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2019
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
|
||||
* street, Riga, Latvia, EU, LV-1050.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const co = require('co');
|
||||
var sqlBase = require('./baseConnector');
|
||||
const db = require("dmdb");
|
||||
const config = require('config');
|
||||
|
||||
const cfgDbHost = config.get('services.CoAuthoring.sql.dbHost');
|
||||
const cfgDbPort = config.get('services.CoAuthoring.sql.dbPort');
|
||||
const cfgDbUser = config.get('services.CoAuthoring.sql.dbUser');
|
||||
const cfgDbPass = config.get('services.CoAuthoring.sql.dbPass');
|
||||
const cfgConnectionlimit = config.get('services.CoAuthoring.sql.connectionlimit');
|
||||
const cfgTableResult = config.get('services.CoAuthoring.sql.tableResult');
|
||||
var cfgDamengExtraOptions = config.get('services.CoAuthoring.sql.damengExtraOptions');
|
||||
|
||||
var pool = null;
|
||||
let connectString = `dm://${cfgDbUser}:${cfgDbPass}@${cfgDbHost}:${cfgDbPort}`;
|
||||
let connectionConfig = {
|
||||
connectString: connectString,
|
||||
poolMax: cfgConnectionlimit,
|
||||
poolMin: 0,
|
||||
localTimezone: 0//todo check utc timezone
|
||||
};
|
||||
config.util.extendDeep(connectionConfig, cfgDamengExtraOptions);
|
||||
//todo create promise interface for other DB
|
||||
db.createPool(connectionConfig).then(function(_pool) {
|
||||
pool = _pool;
|
||||
});
|
||||
|
||||
function readLob(lob) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
var blobData = Buffer.alloc(0);
|
||||
var totalLength = 0;
|
||||
lob.on('data', function(chunk) {
|
||||
totalLength += chunk.length;
|
||||
blobData = Buffer.concat([blobData, chunk], totalLength);
|
||||
});
|
||||
lob.on('error', function(err) {
|
||||
reject(err);
|
||||
});
|
||||
lob.on('end', function() {
|
||||
resolve(blobData);
|
||||
});
|
||||
});
|
||||
}
|
||||
function formatResult(result) {
|
||||
return co(function *() {
|
||||
let res = [];
|
||||
if (result?.rows && result ?.metaData) {
|
||||
for (let i = 0; i < result.rows.length; ++i) {
|
||||
let row = result.rows[i];
|
||||
let out = {};
|
||||
for (let j = 0; j < result.metaData.length; ++j) {
|
||||
let columnName = result.metaData[j].name.toLowerCase();
|
||||
if (row[j]?.on) {
|
||||
let buf = yield readLob(row[j]);
|
||||
out[columnName] = buf.toString('utf8');
|
||||
} else {
|
||||
out[columnName] = row[j];
|
||||
}
|
||||
}
|
||||
res.push(out);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
});
|
||||
}
|
||||
exports.sqlQuery = function (ctx, sqlCommand, callbackFunction, opt_noModifyRes, opt_noLog, opt_values) {
|
||||
co(function *() {
|
||||
ctx.logger.warn('sqlCommand: %s', sqlCommand);
|
||||
ctx.logger.warn(`sqlCommand: %j`, opt_values);
|
||||
|
||||
var result = null;
|
||||
var error = null;
|
||||
let conn;
|
||||
try {
|
||||
conn = yield pool.getConnection();
|
||||
result = yield conn.execute(sqlCommand, opt_values, {resultSet: false});
|
||||
} catch (err) {
|
||||
error = err;
|
||||
if (!opt_noLog) {
|
||||
ctx.logger.warn('sqlQuery error sqlCommand: %s: %s', sqlCommand.slice(0, 50), err.stack);
|
||||
}
|
||||
} finally {
|
||||
if (callbackFunction) {
|
||||
if (conn) {
|
||||
yield conn.close();
|
||||
}
|
||||
var output = result;
|
||||
if(!opt_noModifyRes) {
|
||||
if (result?.rows) {
|
||||
output = yield formatResult(result);
|
||||
} else if(result?.rowsAffected){
|
||||
output = {affectedRows: result.rowsAffected};
|
||||
} else {
|
||||
output = {rows: [], affectedRows: 0};
|
||||
}
|
||||
}
|
||||
callbackFunction(error, output);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
let addSqlParam = function (val, values) {
|
||||
values.push({val: val});
|
||||
return ':' + values.length;
|
||||
};
|
||||
exports.addSqlParameter = addSqlParam;
|
||||
let concatParams = function (val1, val2) {
|
||||
return `CONCAT(COALESCE(${val1}, ''), COALESCE(${val2}, ''))`;
|
||||
};
|
||||
exports.concatParams = concatParams;
|
||||
|
||||
exports.upsert = function(ctx, task, opt_updateUserIndex) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
task.completeDefaults();
|
||||
let dateNow = new Date();
|
||||
let values = [];
|
||||
let cbInsert = task.callback;
|
||||
if (task.callback) {
|
||||
let userCallback = new sqlBase.UserCallback();
|
||||
userCallback.fromValues(task.userIndex, task.callback);
|
||||
cbInsert = userCallback.toSQLInsert();
|
||||
}
|
||||
let p0 = addSqlParam(task.tenant, values);
|
||||
let p1 = addSqlParam(task.key, values);
|
||||
let p2 = addSqlParam(task.status, values);
|
||||
let p3 = addSqlParam(task.statusInfo, values);
|
||||
let p4 = addSqlParam(dateNow, values);
|
||||
let p5 = addSqlParam(task.userIndex, values);
|
||||
let p6 = addSqlParam(task.changeId, values);
|
||||
let p7 = addSqlParam(cbInsert, values);
|
||||
let p8 = addSqlParam(task.baseurl, values);
|
||||
let p9 = addSqlParam(dateNow, values);
|
||||
var sqlCommand = `MERGE INTO ${cfgTableResult} USING dual ON (tenant = ${p0} AND id = ${p1}) `;
|
||||
sqlCommand += `WHEN NOT MATCHED THEN INSERT (tenant, id, status, status_info, last_open_date, user_index, change_id, callback, baseurl) `;
|
||||
sqlCommand += `VALUES (${p0}, ${p1}, ${p2}, ${p3}, ${p4}, ${p5}, ${p6}, ${p7}, ${p8}) `;
|
||||
sqlCommand += `WHEN MATCHED THEN UPDATE SET last_open_date = ${p9}`;
|
||||
if (task.callback) {
|
||||
let p10 = addSqlParam(JSON.stringify(task.callback), values);
|
||||
sqlCommand += `, callback = CONCAT(callback , '${sqlBase.UserCallback.prototype.delimiter}{"userIndex":' , (user_index + 1) , ',"callback":', ${p10}, '}')`;
|
||||
}
|
||||
if (task.baseurl) {
|
||||
let p11 = addSqlParam(task.baseurl, values);
|
||||
sqlCommand += `, baseurl = ${p11}`;
|
||||
}
|
||||
if (opt_updateUserIndex) {
|
||||
sqlCommand += ', user_index = user_index + 1';
|
||||
}
|
||||
sqlCommand += ';';
|
||||
sqlCommand += `SELECT user_index FROM ${cfgTableResult} WHERE tenant = ${p0} AND id = ${p1};`;
|
||||
exports.sqlQuery(ctx, sqlCommand, function(error, result) {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
let out = {affectedRows: 0, insertId: 0};
|
||||
if (result?.length > 0) {
|
||||
var first = result[0];
|
||||
out.affectedRows = task.userIndex !== first.user_index ? 2 : 1;
|
||||
out.insertId = first.user_index;
|
||||
}
|
||||
resolve(out);
|
||||
}
|
||||
}, undefined, undefined, values);
|
||||
});
|
||||
};
|
||||
exports.getTableColumns = function(ctx, tableName) {
|
||||
//todo
|
||||
return new Promise(function(resolve, reject) {
|
||||
resolve([]);
|
||||
});
|
||||
};
|
||||
41
schema/dameng/createdb.sql
Normal file
41
schema/dameng/createdb.sql
Normal file
@ -0,0 +1,41 @@
|
||||
--
|
||||
-- Create schema onlyoffice
|
||||
--
|
||||
|
||||
-- CREATE DATABASE onlyoffice ENCODING = 'UTF8' CONNECTION LIMIT = -1;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for doc_changes
|
||||
-- ----------------------------
|
||||
CREATE TABLE onlyoffice.doc_changes
|
||||
(
|
||||
tenant varchar(255) NOT NULL,
|
||||
id varchar(255) NOT NULL,
|
||||
change_id int NOT NULL,
|
||||
user_id varchar(255) NOT NULL,
|
||||
user_id_original varchar(255) NOT NULL,
|
||||
user_name varchar(255) NOT NULL,
|
||||
change_data text NOT NULL,
|
||||
change_date TIMESTAMP(6) NOT NULL,
|
||||
PRIMARY KEY (tenant, id, change_id)
|
||||
);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for task_result
|
||||
-- ----------------------------
|
||||
CREATE TABLE onlyoffice.task_result
|
||||
(
|
||||
tenant varchar(255) NOT NULL,
|
||||
id varchar(255) NOT NULL,
|
||||
status int NOT NULL,
|
||||
status_info int NOT NULL,
|
||||
created_at TIMESTAMP(6) DEFAULT NOW(),
|
||||
last_open_date TIMESTAMP(6) NOT NULL,
|
||||
user_index int NOT NULL DEFAULT 1,
|
||||
change_id int NOT NULL DEFAULT 0,
|
||||
callback text NOT NULL,
|
||||
baseurl text NOT NULL,
|
||||
password text NULL,
|
||||
additional text NULL,
|
||||
PRIMARY KEY (tenant, id)
|
||||
);
|
||||
4
schema/dameng/removedb.sql
Normal file
4
schema/dameng/removedb.sql
Normal file
@ -0,0 +1,4 @@
|
||||
--error: Try to drop default schema of user [ONLYOFFICE]
|
||||
--DROP SCHEMA onlyoffice;
|
||||
|
||||
DROP USER "ONLYOFFICE" CASCADE;
|
||||
2
schema/dameng/removetbl.sql
Normal file
2
schema/dameng/removetbl.sql
Normal file
@ -0,0 +1,2 @@
|
||||
DROP TABLE IF EXISTS "doc_changes";
|
||||
DROP TABLE IF EXISTS "task_result";
|
||||
Reference in New Issue
Block a user