mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Fix group migration on MySQL (#8404)
* Remove groupsInUse check * Fix group migration on MySQL Fixes #8369
This commit is contained in:
@@ -4,8 +4,6 @@ import { uniq } from 'lodash';
|
||||
export async function up(knex: Knex): Promise<void> {
|
||||
const groupsInUse = await knex.select('id', 'group').from('directus_fields').whereNotNull('group');
|
||||
|
||||
if (groupsInUse.length === 0) return;
|
||||
|
||||
const groupIDs: number[] = uniq(groupsInUse.map(({ group }) => group));
|
||||
|
||||
const groupFields = await knex.select('id', 'field').from('directus_fields').whereIn('id', groupIDs);
|
||||
@@ -16,6 +14,10 @@ export async function up(knex: Knex): Promise<void> {
|
||||
groupMap.set(id, field);
|
||||
}
|
||||
|
||||
await knex.schema.alterTable('directus_fields', (table) => {
|
||||
table.dropForeign('group');
|
||||
});
|
||||
|
||||
await knex.schema.alterTable('directus_fields', (table) => {
|
||||
table.dropColumn('group');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user