mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-17 08:35:52 +00:00
24 lines
744 B
TypeScript
24 lines
744 B
TypeScript
import { Knex } from "knex";
|
|
|
|
import { SecretSharingAccessType } from "@app/lib/types";
|
|
|
|
import { TableName } from "../schemas";
|
|
|
|
export async function up(knex: Knex): Promise<void> {
|
|
const hasColumn = await knex.schema.hasColumn(TableName.SecretSharing, "accessType");
|
|
if (!hasColumn) {
|
|
await knex.schema.table(TableName.SecretSharing, (table) => {
|
|
table.string("accessType").notNullable().defaultTo(SecretSharingAccessType.Anyone);
|
|
});
|
|
}
|
|
}
|
|
|
|
export async function down(knex: Knex): Promise<void> {
|
|
const hasColumn = await knex.schema.hasColumn(TableName.SecretSharing, "accessType");
|
|
if (hasColumn) {
|
|
await knex.schema.table(TableName.SecretSharing, (table) => {
|
|
table.dropColumn("accessType");
|
|
});
|
|
}
|
|
}
|