mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-04 01:26:09 +00:00
migration tweak
This commit is contained in:
@@ -3,7 +3,10 @@ import { Knex } from "knex";
|
||||
import { TableName } from "../schemas";
|
||||
|
||||
export async function up(knex: Knex): Promise<void> {
|
||||
if (await knex.schema.hasTable(TableName.CertificateBody)) {
|
||||
if (
|
||||
(await knex.schema.hasTable(TableName.CertificateBody)) &&
|
||||
!(await knex.schema.hasColumn(TableName.CertificateBody, "encryptedCertificateChain"))
|
||||
) {
|
||||
await knex.schema.alterTable(TableName.CertificateBody, (t) => {
|
||||
t.binary("encryptedCertificateChain").nullable();
|
||||
});
|
||||
@@ -25,7 +28,10 @@ export async function down(knex: Knex): Promise<void> {
|
||||
await knex.schema.dropTable(TableName.CertificateSecret);
|
||||
}
|
||||
|
||||
if (await knex.schema.hasTable(TableName.CertificateBody)) {
|
||||
if (
|
||||
(await knex.schema.hasTable(TableName.CertificateBody)) &&
|
||||
(await knex.schema.hasColumn(TableName.CertificateBody, "encryptedCertificateChain"))
|
||||
) {
|
||||
await knex.schema.alterTable(TableName.CertificateBody, (t) => {
|
||||
t.dropColumn("encryptedCertificateChain");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user