mirror of
https://github.com/outline/outline.git
synced 2026-06-13 03:14:59 +03:00
1a893b0e45
Adds group sync from external authentication providers, allowing team group memberships to be automatically managed based on provider data on sign-in in the future.
80 lines
2.0 KiB
JavaScript
80 lines
2.0 KiB
JavaScript
"use strict";
|
|
|
|
module.exports = {
|
|
async up(queryInterface, Sequelize) {
|
|
return queryInterface.sequelize.transaction(async (transaction) => {
|
|
await queryInterface.createTable(
|
|
"external_groups",
|
|
{
|
|
id: {
|
|
type: Sequelize.UUID,
|
|
allowNull: false,
|
|
defaultValue: Sequelize.UUIDV4,
|
|
primaryKey: true,
|
|
},
|
|
externalId: {
|
|
type: Sequelize.STRING,
|
|
allowNull: false,
|
|
},
|
|
name: {
|
|
type: Sequelize.STRING,
|
|
allowNull: false,
|
|
},
|
|
groupId: {
|
|
type: Sequelize.UUID,
|
|
allowNull: true,
|
|
references: {
|
|
model: "groups",
|
|
key: "id",
|
|
},
|
|
onDelete: "SET NULL",
|
|
},
|
|
authenticationProviderId: {
|
|
type: Sequelize.UUID,
|
|
allowNull: false,
|
|
references: {
|
|
model: "authentication_providers",
|
|
key: "id",
|
|
},
|
|
onDelete: "CASCADE",
|
|
},
|
|
teamId: {
|
|
type: Sequelize.UUID,
|
|
allowNull: false,
|
|
references: {
|
|
model: "teams",
|
|
key: "id",
|
|
},
|
|
onDelete: "CASCADE",
|
|
},
|
|
lastSyncedAt: {
|
|
type: Sequelize.DATE,
|
|
allowNull: true,
|
|
},
|
|
createdAt: {
|
|
type: Sequelize.DATE,
|
|
allowNull: false,
|
|
},
|
|
updatedAt: {
|
|
type: Sequelize.DATE,
|
|
allowNull: false,
|
|
},
|
|
},
|
|
{ transaction }
|
|
);
|
|
|
|
await queryInterface.addIndex(
|
|
"external_groups",
|
|
["authenticationProviderId", "externalId"],
|
|
{ unique: true, transaction }
|
|
);
|
|
});
|
|
},
|
|
|
|
async down(queryInterface) {
|
|
return queryInterface.sequelize.transaction(async (transaction) => {
|
|
await queryInterface.dropTable("external_groups", { transaction });
|
|
});
|
|
},
|
|
};
|