mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-08 01:27:31 +00:00
feat: made the non used columns nullable
This commit is contained in:
@@ -14,12 +14,14 @@ const BATCH_SIZE = 500;
|
|||||||
export async function up(knex: Knex): Promise<void> {
|
export async function up(knex: Knex): Promise<void> {
|
||||||
const hasEncryptedKey = await knex.schema.hasColumn(TableName.Webhook, "encryptedPassKey");
|
const hasEncryptedKey = await knex.schema.hasColumn(TableName.Webhook, "encryptedPassKey");
|
||||||
const hasEncryptedUrl = await knex.schema.hasColumn(TableName.Webhook, "encryptedUrl");
|
const hasEncryptedUrl = await knex.schema.hasColumn(TableName.Webhook, "encryptedUrl");
|
||||||
|
const hasUrl = await knex.schema.hasColumn(TableName.Webhook, "url");
|
||||||
|
|
||||||
const hasWebhookTable = await knex.schema.hasTable(TableName.Webhook);
|
const hasWebhookTable = await knex.schema.hasTable(TableName.Webhook);
|
||||||
if (hasWebhookTable) {
|
if (hasWebhookTable) {
|
||||||
await knex.schema.alterTable(TableName.Webhook, (t) => {
|
await knex.schema.alterTable(TableName.Webhook, (t) => {
|
||||||
if (!hasEncryptedKey) t.binary("encryptedPassKey");
|
if (!hasEncryptedKey) t.binary("encryptedPassKey");
|
||||||
if (!hasEncryptedUrl) t.binary("encryptedUrl");
|
if (!hasEncryptedUrl) t.binary("encryptedUrl");
|
||||||
|
if (hasUrl) t.string("url").nullable().alter();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,11 +14,17 @@ import { getMigrationEncryptionServices } from "./utils/services";
|
|||||||
const BATCH_SIZE = 500;
|
const BATCH_SIZE = 500;
|
||||||
export async function up(knex: Knex): Promise<void> {
|
export async function up(knex: Knex): Promise<void> {
|
||||||
const hasEncryptedInputColumn = await knex.schema.hasColumn(TableName.DynamicSecret, "encryptedInput");
|
const hasEncryptedInputColumn = await knex.schema.hasColumn(TableName.DynamicSecret, "encryptedInput");
|
||||||
|
const hasInputCiphertextColumn = await knex.schema.hasColumn(TableName.DynamicSecret, "inputCiphertext");
|
||||||
|
const hasInputIVColumn = await knex.schema.hasColumn(TableName.DynamicSecret, "inputIV");
|
||||||
|
const hasInputTagColumn = await knex.schema.hasColumn(TableName.DynamicSecret, "inputTag");
|
||||||
|
|
||||||
const hasDynamicSecretTable = await knex.schema.hasTable(TableName.DynamicSecret);
|
const hasDynamicSecretTable = await knex.schema.hasTable(TableName.DynamicSecret);
|
||||||
if (hasDynamicSecretTable) {
|
if (hasDynamicSecretTable) {
|
||||||
await knex.schema.alterTable(TableName.DynamicSecret, (t) => {
|
await knex.schema.alterTable(TableName.DynamicSecret, (t) => {
|
||||||
if (!hasEncryptedInputColumn) t.binary("encryptedInput");
|
if (!hasEncryptedInputColumn) t.binary("encryptedInput");
|
||||||
|
if (hasInputCiphertextColumn) t.text("inputCiphertext").nullable().alter();
|
||||||
|
if (hasInputIVColumn) t.string("inputIV").nullable().alter();
|
||||||
|
if (hasInputTagColumn) t.string("inputTag").nullable().alter();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user