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