Browse Source

fix: missing pk for user junction table (#8973)

pull/8989/head
Mert E 5 months ago committed by GitHub
parent
commit
b8c3139933
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      packages/nocodb/src/meta/migrations/XcMigrationSourcev2.ts
  2. 16
      packages/nocodb/src/meta/migrations/v2/nc_055_junction_pk.ts

4
packages/nocodb/src/meta/migrations/XcMigrationSourcev2.ts

@ -41,6 +41,7 @@ import * as nc_051_source_readonly_columns from '~/meta/migrations/v2/nc_051_sou
import * as nc_052_field_aggregation from '~/meta/migrations/v2/nc_052_field_aggregation';
import * as nc_053_jobs from '~/meta/migrations/v2/nc_053_jobs';
import * as nc_054_id_length from '~/meta/migrations/v2/nc_054_id_length';
import * as nc_055_junction_pk from '~/meta/migrations/v2/nc_055_junction_pk';
// Create a custom migration source class
export default class XcMigrationSourcev2 {
@ -93,6 +94,7 @@ export default class XcMigrationSourcev2 {
'nc_052_field_aggregation',
'nc_053_jobs',
'nc_054_id_length',
'nc_055_junction_pk',
]);
}
@ -188,6 +190,8 @@ export default class XcMigrationSourcev2 {
return nc_053_jobs;
case 'nc_054_id_length':
return nc_054_id_length;
case 'nc_055_junction_pk':
return nc_055_junction_pk;
}
}
}

16
packages/nocodb/src/meta/migrations/v2/nc_055_junction_pk.ts

@ -0,0 +1,16 @@
import type { Knex } from 'knex';
import { MetaTable } from '~/utils/globals';
const up = async (knex: Knex) => {
await knex.schema.alterTable(MetaTable.PROJECT_USERS, (table) => {
table.primary(['base_id', 'fk_user_id']);
});
};
const down = async (knex: Knex) => {
await knex.schema.alterTable(MetaTable.PROJECT_USERS, (table) => {
table.dropPrimary();
});
};
export { up, down };
Loading…
Cancel
Save