mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 03:27:15 +00:00
review fixes
This commit is contained in:
@@ -6,22 +6,20 @@ export async function up(knex: Knex): Promise<void> {
|
|||||||
if (await knex.schema.hasTable(TableName.Certificate)) {
|
if (await knex.schema.hasTable(TableName.Certificate)) {
|
||||||
const hasProjectIdColumn = await knex.schema.hasColumn(TableName.Certificate, "projectId");
|
const hasProjectIdColumn = await knex.schema.hasColumn(TableName.Certificate, "projectId");
|
||||||
if (!hasProjectIdColumn) {
|
if (!hasProjectIdColumn) {
|
||||||
await knex.transaction(async (trx) => {
|
await knex.schema.alterTable(TableName.Certificate, (t) => {
|
||||||
await trx.schema.alterTable(TableName.Certificate, (t) => {
|
t.string("projectId", 36).nullable();
|
||||||
t.string("projectId", 36).nullable();
|
t.foreign("projectId").references("id").inTable(TableName.Project).onDelete("CASCADE");
|
||||||
t.foreign("projectId").references("id").inTable(TableName.Project).onDelete("CASCADE");
|
});
|
||||||
});
|
|
||||||
|
|
||||||
await trx.raw(`
|
await knex.raw(`
|
||||||
UPDATE "${TableName.Certificate}" cert
|
UPDATE "${TableName.Certificate}" cert
|
||||||
SET "projectId" = ca."projectId"
|
SET "projectId" = ca."projectId"
|
||||||
FROM "${TableName.CertificateAuthority}" ca
|
FROM "${TableName.CertificateAuthority}" ca
|
||||||
WHERE cert."caId" = ca.id
|
WHERE cert."caId" = ca.id
|
||||||
`);
|
`);
|
||||||
|
|
||||||
await trx.schema.alterTable(TableName.Certificate, (t) => {
|
await knex.schema.alterTable(TableName.Certificate, (t) => {
|
||||||
t.string("projectId").notNullable().alter();
|
t.string("projectId").notNullable().alter();
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -449,7 +449,8 @@ export const pkiSubscriberServiceFactory = ({
|
|||||||
notBefore: notBeforeDate,
|
notBefore: notBeforeDate,
|
||||||
notAfter: notAfterDate,
|
notAfter: notAfterDate,
|
||||||
keyUsages: selectedKeyUsages,
|
keyUsages: selectedKeyUsages,
|
||||||
extendedKeyUsages: subscriber.extendedKeyUsages as CertExtendedKeyUsage[]
|
extendedKeyUsages: subscriber.extendedKeyUsages as CertExtendedKeyUsage[],
|
||||||
|
projectId
|
||||||
},
|
},
|
||||||
tx
|
tx
|
||||||
);
|
);
|
||||||
@@ -718,7 +719,8 @@ export const pkiSubscriberServiceFactory = ({
|
|||||||
notBefore: notBeforeDate,
|
notBefore: notBeforeDate,
|
||||||
notAfter: notAfterDate,
|
notAfter: notAfterDate,
|
||||||
keyUsages: selectedKeyUsages,
|
keyUsages: selectedKeyUsages,
|
||||||
extendedKeyUsages: selectedExtendedKeyUsages
|
extendedKeyUsages: selectedExtendedKeyUsages,
|
||||||
|
projectId
|
||||||
},
|
},
|
||||||
tx
|
tx
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user