mirror of
https://github.com/outline/outline.git
synced 2026-06-29 11:14:23 +03:00
6a1f2399db
* feat: Collection subscription * refactor to use latest impl * load subscriptions only once * tests, type rename, migration index * all users in publish flow * tsc * remove SubscriptionType.Collection enum * review
45 lines
1.1 KiB
JavaScript
45 lines
1.1 KiB
JavaScript
"use strict";
|
|
|
|
/** @type {import('sequelize-cli').Migration} */
|
|
module.exports = {
|
|
async up(queryInterface, Sequelize) {
|
|
await queryInterface.sequelize.transaction(async transaction => {
|
|
await queryInterface.addColumn(
|
|
"subscriptions",
|
|
"collectionId",
|
|
{
|
|
type: Sequelize.UUID,
|
|
allowNull: true,
|
|
onDelete: "cascade",
|
|
references: {
|
|
model: "collections",
|
|
},
|
|
},
|
|
{ transaction }
|
|
);
|
|
await queryInterface.addIndex(
|
|
"subscriptions",
|
|
["userId", "collectionId", "event"],
|
|
{
|
|
name: "subscriptions_user_id_collection_id_event",
|
|
type: "UNIQUE",
|
|
transaction,
|
|
}
|
|
);
|
|
});
|
|
},
|
|
|
|
async down(queryInterface, Sequelize) {
|
|
await queryInterface.sequelize.transaction(async transaction => {
|
|
await queryInterface.removeIndex(
|
|
"subscriptions",
|
|
["userId", "collectionId", "event"],
|
|
{ transaction }
|
|
);
|
|
await queryInterface.removeColumn("subscriptions", "collectionId", {
|
|
transaction,
|
|
});
|
|
});
|
|
},
|
|
};
|