mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Fix recursive relation constraint for MSSQL
This commit is contained in:
@@ -3,7 +3,7 @@ import { Knex } from 'knex';
|
||||
export async function up(knex: Knex): Promise<void> {
|
||||
await knex.schema.alterTable('directus_collections', (table) => {
|
||||
table.integer('sort');
|
||||
table.string('group', 64).references('collection').inTable('directus_collections').onDelete('SET NULL');
|
||||
table.string('group', 64).references('collection').inTable('directus_collections');
|
||||
table.string('collapse').defaultTo('open').notNullable();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -365,6 +365,9 @@ export class CollectionsService {
|
||||
}
|
||||
|
||||
await this.knex.transaction(async (trx) => {
|
||||
// Make sure this collection isn't used as a group in any other collections
|
||||
await trx('directus_collections').update({ group: null }).where({ group: collectionKey });
|
||||
|
||||
if (collectionToBeDeleted!.meta) {
|
||||
const collectionItemsService = new ItemsService('directus_collections', {
|
||||
knex: trx,
|
||||
|
||||
Reference in New Issue
Block a user