Merge pull request #1503 from Infisical/patch-super-user-migration

update admin config to  default uuid if it doesn't exist
This commit is contained in:
Maidul Islam
2024-02-29 17:11:15 -05:00
committed by GitHub

View File

@@ -16,6 +16,12 @@ export async function up(knex: Knex): Promise<void> {
.whereNotNull("id")
.andWhere("id", "<>", ADMIN_CONFIG_UUID)
.limit(1);
const superUserConfigExists = await knex(TableName.SuperAdmin).where("id", ADMIN_CONFIG_UUID).first();
if (!superUserConfigExists) {
await knex(TableName.SuperAdmin).update({ id: ADMIN_CONFIG_UUID }).whereNotNull("id").limit(1);
}
}
export async function down(knex: Knex): Promise<void> {