mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 07:26:45 +00:00
Delete PKI templates on project removal to avoid blocking users from removing PKI projects
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> {
|
||||||
|
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);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user