Add column id to user_permissions and group_permissions (#6181)
* fix: add column id to user_permissions and group_permissions * fix: don't drop ext * fix: put back default value
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
async up(queryInterface, Sequelize) {
|
||||
await queryInterface.sequelize.transaction(async (transaction) => {
|
||||
await queryInterface.sequelize.query(
|
||||
`CREATE EXTENSION IF NOT EXISTS "uuid-ossp";`,
|
||||
{ transaction }
|
||||
);
|
||||
await queryInterface.addColumn(
|
||||
"user_permissions",
|
||||
"id",
|
||||
{
|
||||
type: Sequelize.UUID,
|
||||
defaultValue: Sequelize.literal("uuid_generate_v4()"),
|
||||
allowNull: false,
|
||||
},
|
||||
{ transaction }
|
||||
);
|
||||
await queryInterface.addConstraint("user_permissions", {
|
||||
type: "PRIMARY KEY",
|
||||
fields: ["id"],
|
||||
transaction,
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
async down(queryInterface, Sequelize) {
|
||||
await queryInterface.removeColumn("user_permissions", "id");
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
async up(queryInterface, Sequelize) {
|
||||
await queryInterface.sequelize.transaction(async (transaction) => {
|
||||
await queryInterface.sequelize.query(
|
||||
`CREATE EXTENSION IF NOT EXISTS "uuid-ossp";`,
|
||||
{ transaction }
|
||||
);
|
||||
await queryInterface.addColumn(
|
||||
"group_permissions",
|
||||
"id",
|
||||
{
|
||||
type: Sequelize.UUID,
|
||||
defaultValue: Sequelize.literal("uuid_generate_v4()"),
|
||||
allowNull: false,
|
||||
},
|
||||
{ transaction }
|
||||
);
|
||||
await queryInterface.addConstraint("group_permissions", {
|
||||
type: "PRIMARY KEY",
|
||||
fields: ["id"],
|
||||
transaction,
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
async down(queryInterface, Sequelize) {
|
||||
await queryInterface.removeColumn("group_permissions", "id");
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user