mirror of
https://github.com/outline/outline.git
synced 2026-11-26 23:50:14 +03:00
Upgrade pg and sequelize to support node 14+
This commit is contained in:
1 parent
810dc5a061
commit
d322f510f8
6 files changed
+20
-18
No files matched your search
+6
-6
@@ -48,7 +48,7 @@
|
||||
]
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 12 <14"
|
||||
"node": ">= 12"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -111,8 +111,8 @@
|
||||
"nodemailer": "^4.4.0",
|
||||
"outline-icons": "^1.21.0-6",
|
||||
"oy-vey": "^0.10.0",
|
||||
"pg": "^6.1.5",
|
||||
"pg-hstore": "2.3.2",
|
||||
"pg": "^8.3.0",
|
||||
"pg-hstore": "^2.3.3",
|
||||
"polished": "3.6.5",
|
||||
"query-string": "^4.3.4",
|
||||
"randomstring": "1.1.5",
|
||||
@@ -131,9 +131,9 @@
|
||||
"react-waypoint": "^9.0.2",
|
||||
"rich-markdown-editor": "^10.5.0",
|
||||
"semver": "^7.3.2",
|
||||
"sequelize": "^5.21.1",
|
||||
"sequelize-cli": "^5.5.0",
|
||||
"sequelize-encrypted": "^0.1.0",
|
||||
"sequelize": "^6.3.4",
|
||||
"sequelize-cli": "^6.2.0",
|
||||
"sequelize-encrypted": "^1.0.0",
|
||||
"slate": "0.45.0",
|
||||
"slate-md-serializer": "5.5.4",
|
||||
"slug": "^1.0.0",
|
||||
|
||||
@@ -9,7 +9,7 @@ const Authentication = sequelize.define("authentication", {
|
||||
},
|
||||
service: DataTypes.STRING,
|
||||
scopes: DataTypes.ARRAY(DataTypes.STRING),
|
||||
token: encryptedFields.vault("token"),
|
||||
token: encryptedFields().vault("token"),
|
||||
});
|
||||
|
||||
Authentication.associate = (models) => {
|
||||
|
||||
@@ -27,7 +27,7 @@ const User = sequelize.define(
|
||||
service: { type: DataTypes.STRING, allowNull: true },
|
||||
serviceId: { type: DataTypes.STRING, allowNull: true, unique: true },
|
||||
slackData: DataTypes.JSONB,
|
||||
jwtSecret: encryptedFields.vault("jwtSecret"),
|
||||
jwtSecret: encryptedFields().vault("jwtSecret"),
|
||||
lastActiveAt: DataTypes.DATE,
|
||||
lastActiveIp: { type: DataTypes.STRING, allowNull: true },
|
||||
lastSignedInAt: DataTypes.DATE,
|
||||
|
||||
@@ -72,11 +72,13 @@ export default async function present(document: Document, options: ?Options) {
|
||||
data.updatedBy = presentUser(document.updatedBy);
|
||||
|
||||
// TODO: This could be further optimized
|
||||
data.collaborators = await User.findAll({
|
||||
where: {
|
||||
id: takeRight(document.collaboratorIds, 10) || [],
|
||||
},
|
||||
}).map(presentUser);
|
||||
data.collaborators = (
|
||||
await User.findAll({
|
||||
where: {
|
||||
id: takeRight(document.collaboratorIds, 10) || [],
|
||||
},
|
||||
})
|
||||
).map(presentUser);
|
||||
}
|
||||
|
||||
return data;
|
||||
|
||||
+2
-4
@@ -3,10 +3,8 @@ import debug from "debug";
|
||||
import Sequelize from "sequelize";
|
||||
import EncryptedField from "sequelize-encrypted";
|
||||
|
||||
export const encryptedFields = EncryptedField(
|
||||
Sequelize,
|
||||
process.env.SECRET_KEY
|
||||
);
|
||||
export const encryptedFields = () =>
|
||||
EncryptedField(Sequelize, process.env.SECRET_KEY);
|
||||
|
||||
export const DataTypes = Sequelize;
|
||||
export const Op = Sequelize.Op;
|
||||
|
||||
@@ -6,7 +6,9 @@ export function flushdb() {
|
||||
const sql = sequelize.getQueryInterface();
|
||||
const tables = Object.keys(sequelize.models).map((model) => {
|
||||
const n = sequelize.models[model].getTableName();
|
||||
return sql.quoteTable(typeof n === "string" ? n : n.tableName);
|
||||
return sql.queryGenerator.quoteTable(
|
||||
typeof n === "string" ? n : n.tableName
|
||||
);
|
||||
});
|
||||
|
||||
const query = `TRUNCATE ${tables.join(", ")} CASCADE`;
|
||||
|
||||
Reference in new issue
Block a user