Fix unique constraint error in rollback deployment
This commit is contained in:
parent
59329c18f6
commit
10cbdf73a3
@ -709,6 +709,8 @@ export class Service {
|
|||||||
deployer = data.deployer;
|
deployer = data.deployer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("DATA>DOMAIN!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",data.domain)
|
||||||
|
|
||||||
const deployment = await this.createDeploymentFromData(userId, data, deployer!.deployerLrn!, applicationRecordId, applicationRecordData, false);
|
const deployment = await this.createDeploymentFromData(userId, data, deployer!.deployerLrn!, applicationRecordId, applicationRecordData, false);
|
||||||
const dnsDeployment = await this.createDeploymentFromData(userId, data, deployer!.deployerLrn!, applicationRecordId, applicationRecordData, true);
|
const dnsDeployment = await this.createDeploymentFromData(userId, data, deployer!.deployerLrn!, applicationRecordId, applicationRecordData, true);
|
||||||
|
|
||||||
@ -1246,7 +1248,7 @@ export class Service {
|
|||||||
|
|
||||||
const newCurrentDeploymentUpdate = await this.db.updateDeploymentById(
|
const newCurrentDeploymentUpdate = await this.db.updateDeploymentById(
|
||||||
deploymentId,
|
deploymentId,
|
||||||
{ isCurrent: true, domain: oldCurrentDeployment.domain },
|
{ isCurrent: true, domain: null },
|
||||||
);
|
);
|
||||||
|
|
||||||
const newCurrentDeployment = await this.db.getDeployment({ where: { id: deploymentId }, relations: { project: true, deployer: true } });
|
const newCurrentDeployment = await this.db.getDeployment({ where: { id: deploymentId }, relations: { project: true, deployer: true } });
|
||||||
@ -1255,6 +1257,25 @@ export class Service {
|
|||||||
throw new Error(`Deployment with Id ${deploymentId} not found`);
|
throw new Error(`Deployment with Id ${deploymentId} not found`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const applicationDeploymentRequestData = newCurrentDeployment.applicationDeploymentRequestData;
|
||||||
|
|
||||||
|
const customDomain = await this.db.getOldestDomainByProjectId(projectId);
|
||||||
|
|
||||||
|
if (customDomain) {
|
||||||
|
await this.db.updateDeployment(
|
||||||
|
{
|
||||||
|
domainId: customDomain.id,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
domain: null,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(customDomain && applicationDeploymentRequestData) {
|
||||||
|
newCurrentDeployment.domain = customDomain
|
||||||
|
}
|
||||||
|
|
||||||
// Create a DNS deployment for the new current deployment
|
// Create a DNS deployment for the new current deployment
|
||||||
const dnsDeployment = await this.createDeploymentFromData(
|
const dnsDeployment = await this.createDeploymentFromData(
|
||||||
newCurrentDeployment.project.ownerId,
|
newCurrentDeployment.project.ownerId,
|
||||||
@ -1265,9 +1286,6 @@ export class Service {
|
|||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
|
|
||||||
const applicationDeploymentRequestData = newCurrentDeployment.applicationDeploymentRequestData;
|
|
||||||
|
|
||||||
applicationDeploymentRequestData!.version = (Number(applicationDeploymentRequestData?.version) + 1).toString();
|
|
||||||
applicationDeploymentRequestData!.meta = JSON.stringify({
|
applicationDeploymentRequestData!.meta = JSON.stringify({
|
||||||
...JSON.parse(applicationDeploymentRequestData!.meta),
|
...JSON.parse(applicationDeploymentRequestData!.meta),
|
||||||
note: `Updated by Snowball @ ${DateTime.utc().toFormat(
|
note: `Updated by Snowball @ ${DateTime.utc().toFormat(
|
||||||
|
Loading…
Reference in New Issue
Block a user