mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-05 10:26:35 +00:00
fix: renamed migration
This commit is contained in:
+5
-5
@@ -3,21 +3,21 @@ 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> {
|
||||||
const hasIsEncryptedByHsmCol = await knex.schema.hasColumn(TableName.KmsServerRootConfig, "isEncryptedByHsm");
|
const hasEncryptionStrategy = await knex.schema.hasColumn(TableName.KmsServerRootConfig, "encryptionStrategy");
|
||||||
const hasTimestampsCol = await knex.schema.hasColumn(TableName.KmsServerRootConfig, "createdAt");
|
const hasTimestampsCol = await knex.schema.hasColumn(TableName.KmsServerRootConfig, "createdAt");
|
||||||
|
|
||||||
await knex.schema.alterTable(TableName.KmsServerRootConfig, (t) => {
|
await knex.schema.alterTable(TableName.KmsServerRootConfig, (t) => {
|
||||||
if (!hasIsEncryptedByHsmCol) t.boolean("isEncryptedByHsm").defaultTo(false).notNullable();
|
if (!hasEncryptionStrategy) t.string("encryptionStrategy").defaultTo("BASIC");
|
||||||
if (!hasTimestampsCol) t.timestamps(true, true);
|
if (!hasTimestampsCol) t.timestamps(true, true, true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(knex: Knex): Promise<void> {
|
export async function down(knex: Knex): Promise<void> {
|
||||||
const hasIsEncryptedByHsmCol = await knex.schema.hasColumn(TableName.KmsServerRootConfig, "isEncryptedByHsm");
|
const hasEncryptionStrategy = await knex.schema.hasColumn(TableName.KmsServerRootConfig, "encryptionStrategy");
|
||||||
const hasTimestampsCol = await knex.schema.hasColumn(TableName.KmsServerRootConfig, "createdAt");
|
const hasTimestampsCol = await knex.schema.hasColumn(TableName.KmsServerRootConfig, "createdAt");
|
||||||
|
|
||||||
await knex.schema.alterTable(TableName.KmsServerRootConfig, (t) => {
|
await knex.schema.alterTable(TableName.KmsServerRootConfig, (t) => {
|
||||||
if (hasIsEncryptedByHsmCol) t.dropColumn("isEncryptedByHsm");
|
if (hasEncryptionStrategy) t.dropColumn("encryptionStrategy");
|
||||||
if (hasTimestampsCol) t.dropTimestamps(true);
|
if (hasTimestampsCol) t.dropTimestamps(true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user