Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
import { Knex } from "knex";
import { TableName } from "../schemas";
import { createOnUpdateTrigger, dropOnUpdateTrigger } from "../utils";
// Dropped by the 20260910093000 migration, so it no longer has a TableName entry.
const VAULT_EXTERNAL_MIGRATION_CONFIGS = "vault_external_migration_configs";
export async function up(knex: Knex): Promise<void> {
if (!(await knex.schema.hasTable(VAULT_EXTERNAL_MIGRATION_CONFIGS))) {
await knex.schema.createTable(VAULT_EXTERNAL_MIGRATION_CONFIGS, (t) => {
t.uuid("id", { primaryKey: true }).defaultTo(knex.fn.uuid());
t.uuid("orgId").notNullable();
t.foreign("orgId").references("id").inTable(TableName.Organization).onDelete("CASCADE");
t.string("namespace").notNullable();
t.uuid("connectionId");
t.foreign("connectionId").references("id").inTable(TableName.AppConnection);
t.timestamps(true, true, true);
t.unique(["orgId", "namespace"]);
});
await createOnUpdateTrigger(knex, VAULT_EXTERNAL_MIGRATION_CONFIGS);
}
}
export async function down(knex: Knex): Promise<void> {
await knex.schema.dropTableIfExists(VAULT_EXTERNAL_MIGRATION_CONFIGS);
await dropOnUpdateTrigger(knex, VAULT_EXTERNAL_MIGRATION_CONFIGS);
}