Add CustomApp types, the gc_custom_apps Drizzle schema, and its migration - #100
Merged
Conversation
conservationtimothy
approved these changes
Aug 11, 2026
| @@ -0,0 +1,100 @@ | |||
| import { asc, eq } from "drizzle-orm"; | |||
Contributor
There was a problem hiding this comment.
We are importing just to export, not sure how I feel but maybe it's inevitable.
Comment on lines
+66
to
+87
| await configDb.transaction(async (tx) => { | ||
| await tx.delete(schema.gcCustomApps); | ||
|
|
||
| if (apps.length === 0) return; | ||
|
|
||
| await tx.insert(schema.gcCustomApps).values( | ||
| apps.map((app, index) => ({ | ||
| id: app.id, | ||
| name: app.name, | ||
| description: app.description, | ||
| iconUrl: app.iconUrl, | ||
| tags: app.tags, | ||
| subdomain: app.subdomain, | ||
| enabled: app.enabled, | ||
| sortOrder: index, | ||
| createdAt: now, | ||
| updatedAt: now, | ||
| })), | ||
| ); | ||
| }); | ||
|
|
||
| return listCustomApps({ includeDisabled: true }); |
Contributor
There was a problem hiding this comment.
Could simplify this slightly: Drizzle transactions can return a value, and Postgres supports .returning(), so we can return the transaction directly and map the inserted rows instead of doing a second listCustomApps() query afterward. See [Drizzle transactions](https://orm.drizzle.team/docs/transactions) and [Postgres returning](https://orm.drizzle.team/docs/insert#insert-returning).
So something like:
const rows = await tx
.insert(schema.gcCustomApps)
.values(
apps.map((app, index) => ({
id: app.id,
name: app.name,
description: app.description,
iconUrl: app.iconUrl,
tags: app.tags,
subdomain: app.subdomain,
enabled: app.enabled,
sortOrder: index,
createdAt: now,
updatedAt: now,
})),
)
.returning();
return rows.map(mapCustomAppRow);
Member
Author
There was a problem hiding this comment.
Thanks, agreed this is an improvement. Implemented in 3808078
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goal
Closes #96.
Screenshots
n/a
What I changed and why
gc_custom_appsDrizzle schema + migration.CustomApptypes/validation helpers and server list/replace utilities for the upcoming admin API and homepage grid.How I convinced myself this is right
Plan validation, and following existing Drizzle / migration conventions.
What I'm not doing here
LLM use disclosure
Cursor Grok 4.5 implementation based on plan. I didn't spot anything that needed fixing.