Adam
Adam
Explore posts from servers
TTCTheo's Typesafe Cult
Created by Adam on 1/2/2024 in #questions
What options are there to perform data migrations?
Hey, thanks for helping me out :) What options do I have to handle data migrations? For example when renaming a column via planetscale, I create a new column and need to backfill the column with data of the old column. Planetscale handles the schema migration (create the new column), but not the data migration (backfilling the data), so what's the best way to handle this (using script files, direct terminal operations, or another method)? Also what process or tool does Theo recommends for handling data migrations? Thanks again.
12 replies
DTDrizzle Team
Created by Adam on 12/21/2023 in #help
Drizzle with MySQL - most optimal way to insert row and immediately retrieve inserted row
Hey, thanks for helping me out :) I'm currently using Drizzle in a serverless application with PlanetScale. Here is some code where I insert a row and immediately after retrieve it:
create: privateProcedure
.mutation(async ({ ctx, input }) => {
const inserted = await ctx.db.insert(posts).values({
content: input.content,
authorId: ctx.currentUser,
});

return ctx.db
.select()
.from(posts)
.where(eq(posts.id, Number(inserted.insertId)));
}),
create: privateProcedure
.mutation(async ({ ctx, input }) => {
const inserted = await ctx.db.insert(posts).values({
content: input.content,
authorId: ctx.currentUser,
});

return ctx.db
.select()
.from(posts)
.where(eq(posts.id, Number(inserted.insertId)));
}),
My question is whether this approach is the most optimal way to use Drizzle for such a pattern, or if there's a recommended best practice or more performent way for insertions followed by immediate retrieval in this context. Thanks!
6 replies
TTCTheo's Typesafe Cult
Created by Adam on 12/16/2023 in #questions
Refreshing Stale UI After Deployment - Seeking Insights
Hey everyone :) After deploying updates via vercel, I assume some users, still on the site without refreshing, interact with a stale UI. They encounter errors, like clicking on UI elements tied to endpoints that no longer exist. How do you ensure your users always interact with an up-to-date UI, even if they haven't refreshed their browser? I assume this is not done by vercel, or next.js, or react itself, is it? I thought maybe somehow asking users to refresh their browser or so might be good, are there some tools or libraries for this? I was searching through the web to find some solutions but could not find any yet, do you know some resources on this topic? Looking forward to hearing your experiences and solutions. Thanks for helping me out! :)
8 replies
TTCTheo's Typesafe Cult
Created by Adam on 12/15/2023 in #questions
T3 stack analytics and logging - Axiom or PostHog?
Hey, thank you for helping me out :) I was just wondering about Axiom and PostHog, for logging and analytics. Both seem to be recommended, PostHog seems a relatively new recommendation, maybe it has some good new feature Axiom does not offer? Are there certain advantages and disadvantages or use cases for both that I should be aware of? Thanks again!
22 replies