mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-19 17:32:37 +00:00
30 lines
1.0 KiB
TypeScript
30 lines
1.0 KiB
TypeScript
import { Knex } from "knex";
|
|
|
|
import { TableName } from "@app/db/schemas";
|
|
|
|
export async function up(knex: Knex): Promise<void> {
|
|
await knex.schema.alterTable(TableName.SecretVersionV2, (table) => {
|
|
table.dropForeign(["userActorId"]);
|
|
table.dropForeign(["identityActorId"]);
|
|
});
|
|
|
|
await knex.schema.alterTable(TableName.SecretVersionV2, (table) => {
|
|
table.foreign("userActorId").references("id").inTable(TableName.Users).onDelete("SET NULL");
|
|
|
|
table.foreign("identityActorId").references("id").inTable(TableName.Identity).onDelete("SET NULL");
|
|
});
|
|
}
|
|
|
|
export async function down(knex: Knex): Promise<void> {
|
|
await knex.schema.alterTable(TableName.SecretVersionV2, (table) => {
|
|
table.dropForeign(["userActorId"]);
|
|
table.dropForeign(["identityActorId"]);
|
|
});
|
|
|
|
await knex.schema.alterTable(TableName.SecretVersionV2, (table) => {
|
|
table.foreign("userActorId").references("id").inTable(TableName.Users);
|
|
|
|
table.foreign("identityActorId").references("id").inTable(TableName.Identity);
|
|
});
|
|
}
|