mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-04 21:26:17 +00:00
Merge pull request #4658 from Infisical/fix/identity-index-fix
feat: added index to membership for identity
This commit is contained in:
@@ -0,0 +1,23 @@
|
|||||||
|
import { Knex } from "knex";
|
||||||
|
|
||||||
|
import { TableName } from "../schemas";
|
||||||
|
|
||||||
|
export async function up(knex: Knex): Promise<void> {
|
||||||
|
const hasScopeColumn = await knex.schema.hasColumn(TableName.Membership, "scope");
|
||||||
|
const hasActorIdentityColumn = await knex.schema.hasColumn(TableName.Membership, "actorIdentityId");
|
||||||
|
if (hasScopeColumn && hasActorIdentityColumn) {
|
||||||
|
await knex.schema.alterTable(TableName.Membership, (t) => {
|
||||||
|
t.index(["scope", "actorIdentityId"]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function down(knex: Knex): Promise<void> {
|
||||||
|
const hasScopeColumn = await knex.schema.hasColumn(TableName.Membership, "scope");
|
||||||
|
const hasActorIdentityColumn = await knex.schema.hasColumn(TableName.Membership, "actorIdentityId");
|
||||||
|
if (hasScopeColumn && hasActorIdentityColumn) {
|
||||||
|
await knex.schema.alterTable(TableName.Membership, (t) => {
|
||||||
|
t.dropIndex(["scope", "actorIdentityId"]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user