mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-20 12:38:19 +00:00
22 lines
750 B
TypeScript
22 lines
750 B
TypeScript
import { Knex } from "knex";
|
|
|
|
import { TableName } from "../schemas";
|
|
|
|
export async function up(knex: Knex): Promise<void> {
|
|
if (await knex.schema.hasTable(TableName.PkiCertificateTemplateV2)) {
|
|
await knex.schema.alterTable(TableName.PkiCertificateTemplateV2, (t) => {
|
|
t.dropForeign(["projectId"]);
|
|
t.foreign("projectId").references("id").inTable(TableName.Project).onDelete("CASCADE");
|
|
});
|
|
}
|
|
}
|
|
|
|
export async function down(knex: Knex): Promise<void> {
|
|
if (await knex.schema.hasTable(TableName.PkiCertificateTemplateV2)) {
|
|
await knex.schema.alterTable(TableName.PkiCertificateTemplateV2, (t) => {
|
|
t.dropForeign(["projectId"]);
|
|
t.foreign("projectId").references("id").inTable(TableName.Project);
|
|
});
|
|
}
|
|
}
|