feat: implement rollback registry functionality in application settings

- Added a new optional field `rollbackRegistryId` to the application schema to support rollback registry selection.
- Enhanced the form in the ShowRollbackSettings component to include a dropdown for selecting a rollback registry when rollbacks are enabled.
- Updated the application service to handle rollback registry logic during deployment and rollback processes.
- Improved error handling and validation for rollback settings, ensuring a registry is selected when rollbacks are active.
- Adjusted database schema and migration files to accommodate the new rollback registry feature.
This commit is contained in:
Mauricio Siu
2025-12-02 00:48:11 -06:00
parent e052850b87
commit 5a7f55ea63
10 changed files with 7077 additions and 109 deletions

View File

@@ -187,6 +187,12 @@ export const applications = pgTable("application", {
registryId: text("registryId").references(() => registry.registryId, {
onDelete: "set null",
}),
rollbackRegistryId: text("rollbackRegistryId").references(
() => registry.registryId,
{
onDelete: "set null",
},
),
environmentId: text("environmentId")
.notNull()
.references(() => environments.environmentId, { onDelete: "cascade" }),
@@ -270,6 +276,11 @@ export const applicationsRelations = relations(
relationName: "applicationBuildRegistry",
}),
previewDeployments: many(previewDeployments),
rollbackRegistry: one(registry, {
fields: [applications.rollbackRegistryId],
references: [registry.registryId],
relationName: "applicationRollbackRegistry",
}),
}),
);

View File

@@ -39,6 +39,9 @@ export const registryRelations = relations(registry, ({ many }) => ({
buildApplications: many(applications, {
relationName: "applicationBuildRegistry",
}),
rollbackApplications: many(applications, {
relationName: "applicationRollbackRegistry",
}),
}));
const createSchema = createInsertSchema(registry, {