 Handle onUpdate/onDelete cascade constraints

This commit is contained in:
Fabio Manganiello 2025-03-08 01:28:02 +01:00
parent e9f4a78784
commit ecbe472acc
Signed by: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -135,7 +135,9 @@ async function createUsersRolesTable(query: { context: any }) {
allowNull: false,
references: {
model: $db.tableName('users'),
key: 'id'
key: 'id',
onDelete: 'CASCADE',
onUpdate: 'CASCADE',
}
},
roleId: {
@ -143,7 +145,9 @@ async function createUsersRolesTable(query: { context: any }) {
allowNull: false,
references: {
model: $db.tableName('roles'),
key: 'id'
key: 'id',
onDelete: 'CASCADE',
onUpdate: 'CASCADE',
}
},
createdAt: {
@ -167,7 +171,9 @@ async function createUserSessionsTable(query: { context: any }) {
allowNull: false,
references: {
model: $db.tableName('users'),
key: 'id'
key: 'id',
onDelete: 'CASCADE',
onUpdate: 'CASCADE',
}
},
name: {
@ -198,7 +204,9 @@ async function createUserDevicesTable(query: { context: any }) {
allowNull: false,
references: {
model: $db.tableName('users'),
key: 'id'
key: 'id',
onDelete: 'CASCADE',
onUpdate: 'CASCADE',
}
},
name: {