mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 13:27:22 +00:00
feat: patched up migration to support pg14
This commit is contained in:
@@ -14,14 +14,10 @@ export async function up(knex: Knex): Promise<void> {
|
|||||||
t.foreign("rootOrgId").references("id").inTable(TableName.Organization).onDelete("CASCADE");
|
t.foreign("rootOrgId").references("id").inTable(TableName.Organization).onDelete("CASCADE");
|
||||||
|
|
||||||
t.dropUnique(["slug"]);
|
t.dropUnique(["slug"]);
|
||||||
|
t.unique(["rootOrgId", "parentOrgId", "slug"]);
|
||||||
});
|
});
|
||||||
|
|
||||||
// had to switch to raw for null not distinct
|
// had to switch to raw for null not distinct
|
||||||
await knex.raw(`
|
|
||||||
ALTER TABLE "organization"
|
|
||||||
ADD CONSTRAINT "organization_root_parent_slug_unique"
|
|
||||||
UNIQUE ("rootOrgId", "parentOrgId", "slug") NULLS NOT DISTINCT;
|
|
||||||
`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const hasIdentityOrgCol = await knex.schema.hasColumn(TableName.Identity, "orgId");
|
const hasIdentityOrgCol = await knex.schema.hasColumn(TableName.Identity, "orgId");
|
||||||
|
|||||||
@@ -516,6 +516,12 @@ export const orgServiceFactory = ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (slug) {
|
||||||
|
const existingOrg = await orgDAL.findOne({ slug, rootOrgId: null });
|
||||||
|
if (existingOrg && existingOrg?.id !== orgId)
|
||||||
|
throw new BadRequestError({ message: `Organization with slug ${slug} already exist` });
|
||||||
|
}
|
||||||
|
|
||||||
if (googleSsoAuthEnforced) {
|
if (googleSsoAuthEnforced) {
|
||||||
if (googleSsoAuthEnforced && currentOrg.authEnforced) {
|
if (googleSsoAuthEnforced && currentOrg.authEnforced) {
|
||||||
throw new BadRequestError({
|
throw new BadRequestError({
|
||||||
|
|||||||
Reference in New Issue
Block a user