mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
add index on secret snapshot folders
This commit is contained in:
@@ -0,0 +1,21 @@
|
|||||||
|
import { Knex } from "knex";
|
||||||
|
|
||||||
|
import { TableName } from "../schemas";
|
||||||
|
|
||||||
|
export async function up(knex: Knex): Promise<void> {
|
||||||
|
const doesSnapshotIdExist = await knex.schema.hasColumn(TableName.SnapshotFolder, "snapshotId");
|
||||||
|
if (await knex.schema.hasTable(TableName.SnapshotFolder)) {
|
||||||
|
await knex.schema.alterTable(TableName.SnapshotFolder, (t) => {
|
||||||
|
if (doesSnapshotIdExist) t.index("snapshotId");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function down(knex: Knex): Promise<void> {
|
||||||
|
const doesSnapshotIdExist = await knex.schema.hasColumn(TableName.SnapshotFolder, "snapshotId");
|
||||||
|
if (await knex.schema.hasTable(TableName.SnapshotFolder)) {
|
||||||
|
await knex.schema.alterTable(TableName.SnapshotFolder, (t) => {
|
||||||
|
if (doesSnapshotIdExist) t.dropIndex("snapshotId");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user