-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
release channels policy #178
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -48,6 +48,18 @@ import { environment } from "./environment.js"; | |||||||||||||||||||||||||||||||||||||||||||||||||
import { job } from "./job.js"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
import { target } from "./target.js"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
export const releaseChannel = pgTable("release_channel", { | ||||||||||||||||||||||||||||||||||||||||||||||||||
id: uuid("id").primaryKey().defaultRandom(), | ||||||||||||||||||||||||||||||||||||||||||||||||||
name: text("name").notNull(), | ||||||||||||||||||||||||||||||||||||||||||||||||||
description: text("description").default(""), | ||||||||||||||||||||||||||||||||||||||||||||||||||
deploymentId: uuid("deployment_id") | ||||||||||||||||||||||||||||||||||||||||||||||||||
.notNull() | ||||||||||||||||||||||||||||||||||||||||||||||||||
.references(() => deployment.id, { onDelete: "cascade" }), | ||||||||||||||||||||||||||||||||||||||||||||||||||
releaseFilter: jsonb("release_filter") | ||||||||||||||||||||||||||||||||||||||||||||||||||
.$type<ReleaseCondition | null>() | ||||||||||||||||||||||||||||||||||||||||||||||||||
.default(sql`NULL`), | ||||||||||||||||||||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+51
to
+61
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Consider adding uniqueness constraint for channel names within a deployment. The current schema allows duplicate channel names within the same deployment, which could lead to confusion. Consider adding a unique index on (deploymentId, name). export const releaseChannel = pgTable("release_channel", {
id: uuid("id").primaryKey().defaultRandom(),
name: text("name").notNull(),
description: text("description").default(""),
deploymentId: uuid("deployment_id")
.notNull()
.references(() => deployment.id, { onDelete: "cascade" }),
releaseFilter: jsonb("release_filter")
.$type<ReleaseCondition | null>()
.default(sql`NULL`),
- });
+ }, (t) => ({
+ unq: uniqueIndex().on(t.deploymentId, t.name)
+ })); 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
export const releaseDependency = pgTable( | ||||||||||||||||||||||||||||||||||||||||||||||||||
"release_dependency", | ||||||||||||||||||||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix incorrect field reference in unique index
customPolicyUniq
The unique index
customPolicyUniq
referencesis_own_policy
, which is not defined in theenvironmentPolicyDeployment
table. The correct field ishasCustomPolicy
. Update theWHERE
clause to usehasCustomPolicy
instead to ensure the index functions as intended.Apply this diff to correct the field reference:
📝 Committable suggestion