mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-17 08:35:52 +00:00
23 lines
733 B
TypeScript
23 lines
733 B
TypeScript
import { Knex } from "knex";
|
|
|
|
import { TableName } from "../schemas";
|
|
|
|
export async function up(knex: Knex): Promise<void> {
|
|
const doesExpireAtExist = await knex.schema.hasColumn(TableName.AuditLog, "expiresAt");
|
|
if (await knex.schema.hasTable(TableName.AuditLog)) {
|
|
await knex.schema.alterTable(TableName.AuditLog, (t) => {
|
|
if (doesExpireAtExist) t.index("expiresAt");
|
|
});
|
|
}
|
|
}
|
|
|
|
export async function down(knex: Knex): Promise<void> {
|
|
const doesExpireAtExist = await knex.schema.hasColumn(TableName.AuditLog, "expiresAt");
|
|
|
|
if (await knex.schema.hasTable(TableName.AuditLog)) {
|
|
await knex.schema.alterTable(TableName.AuditLog, (t) => {
|
|
if (doesExpireAtExist) t.dropIndex("expiresAt");
|
|
});
|
|
}
|
|
}
|