George
George
Explore posts from servers
TtRPC
Created by brumbrum_brum on 8/17/2024 in #❓-help
Procedures with paramters.
I am not sure if this is a good approach or not, but it works well
9 replies
TtRPC
Created by brumbrum_brum on 8/17/2024 in #❓-help
Procedures with paramters.
No description
9 replies
TtRPC
Created by brumbrum_brum on 8/17/2024 in #❓-help
Procedures with paramters.
No description
9 replies
TtRPC
Created by brumbrum_brum on 8/17/2024 in #❓-help
Procedures with paramters.
Yeh I was able to do this, by creating a function that accepts an array of user permissions and returns a trpc middleware:
9 replies
TtRPC
Created by valtyr on 1/2/2024 in #❓-help
Middleware that returns data instead of throwing error
Did u find a solution for this?
3 replies
TTCTheo's Typesafe Cult
Created by Don Franklie on 2/25/2024 in #questions
Uploaded image not showing on Next app
have u tried adding the domain of the images in ur next config
4 replies
DTDrizzle Team
Created by alka_99 on 1/27/2024 in #help
How to not loss data everytime i change the schema
I am trying to learn how to also do this for when I eventually go to prod. Right now I lose data everytime I change my schema and just seed the data base afterwards. However when I deal with real customer data this would mean data loss so what are the recommended way to apply db migrations without data loss? Are there any resources u could point me to, to learn more about migrations without data loss?
4 replies
TTCTheo's Typesafe Cult
Created by swajp on 12/21/2023 in #questions
dynamic grid
If your using tailwind, u could use the grid classes define them in an array and randomly select values in there to generate random grids col / row sizes, u could also use col-span-2 row-span-2 or whatever to get different cell sizes. You could also do this if ur not using tailwind, just gotta create the classes urself.
3 replies
DTDrizzle Team
Created by George on 12/10/2023 in #help
db.batch is missing
Ohhh ok fair enough. Will this feature eventually be available for postgres. Also are there any differences / downsides for using Promise.all over db.batch. Sorry if this is a noobish question.
9 replies
DTDrizzle Team
Created by George on 12/10/2023 in #help
db.batch is missing
No description
9 replies
DTDrizzle Team
Created by George on 12/10/2023 in #help
db.batch is missing
No description
9 replies
TTCTheo's Typesafe Cult
Created by sonor on 12/15/2023 in #questions
How to pass tRPC types?
So it would look like RouterOutputs[“admin_users”][“list”]
5 replies
TTCTheo's Typesafe Cult
Created by sonor on 12/15/2023 in #questions
How to pass tRPC types?
Use the RouterOutputs type
5 replies
TTCTheo's Typesafe Cult
Created by West side ⁉ on 10/14/2023 in #questions
Drizzle-ORM+PSQL: sorry, too many clients already
I used it to fix the same issue with some small modifications:
import { drizzle } from "drizzle-orm/postgres-js";
import { type PostgresJsDatabase } from "drizzle-orm/postgres-js";
import postgres from "postgres";

import { env } from "~/env.mjs";

import * as schema from "./schema"; // where our db tables are defined

// Fix for "sorry, too many clients already" from:
// https://www.answeroverflow.com/m/1146224610002600067

declare global {
// eslint-disable-next-line no-var -- only var works here
var db: PostgresJsDatabase<typeof schema> | undefined;
}

let db: PostgresJsDatabase<typeof schema>;

if (env.NODE_ENV === "production") {
const client = postgres(env.DATABASE_URL);

db = drizzle(client, {
schema,
});
} else {
if (!global.db) {
const client = postgres(env.DATABASE_URL);

global.db = drizzle(client, {
schema,
logger: {
logQuery: (query) => {
// to remove quotes on query string, to make it more readable
console.log({ query: query.replace(/\"/g, "") });
},
},
});
}

db = global.db;
}


type DbInstance = typeof db;

export { db };
export type { DbInstance };
import { drizzle } from "drizzle-orm/postgres-js";
import { type PostgresJsDatabase } from "drizzle-orm/postgres-js";
import postgres from "postgres";

import { env } from "~/env.mjs";

import * as schema from "./schema"; // where our db tables are defined

// Fix for "sorry, too many clients already" from:
// https://www.answeroverflow.com/m/1146224610002600067

declare global {
// eslint-disable-next-line no-var -- only var works here
var db: PostgresJsDatabase<typeof schema> | undefined;
}

let db: PostgresJsDatabase<typeof schema>;

if (env.NODE_ENV === "production") {
const client = postgres(env.DATABASE_URL);

db = drizzle(client, {
schema,
});
} else {
if (!global.db) {
const client = postgres(env.DATABASE_URL);

global.db = drizzle(client, {
schema,
logger: {
logQuery: (query) => {
// to remove quotes on query string, to make it more readable
console.log({ query: query.replace(/\"/g, "") });
},
},
});
}

db = global.db;
}


type DbInstance = typeof db;

export { db };
export type { DbInstance };
9 replies
TTCTheo's Typesafe Cult
Created by West side ⁉ on 10/14/2023 in #questions
Drizzle-ORM+PSQL: sorry, too many clients already
you can checkout this link for a potential fix: https://www.answeroverflow.com/m/1146224610002600067
9 replies
DTDrizzle Team
Created by George on 12/3/2023 in #help
How to create unique constraint on a column for a foreign key?
No description
3 replies
TTCTheo's Typesafe Cult
Created by George on 11/20/2023 in #questions
How to set the generated vercel preview url as the env variable for NEXTAUTH_URL
I have tried to follow this, but I am having diffiuclty making it work: https://vercel.com/guides/how-to-alias-a-preview-deployment-using-the-cli
6 replies
TTCTheo's Typesafe Cult
Created by George on 11/20/2023 in #questions
How to set the generated vercel preview url as the env variable for NEXTAUTH_URL
Thanks for this, but I was not able to make it work, Can I ask how you have set up your github workflow? Also I have added a domain on vercel, that looks like this: "my-domain.vercel.app" . How do I use github action workflow to deploy to this specific domain. I am trying to setup a dev, dev-preview and prod environments, which will all have its own seperate databases on neon.
6 replies
TTCTheo's Typesafe Cult
Created by George on 10/21/2023 in #questions
Does anyone have a working example repo of T3 stack with drizzle and postgres?
Yeh I managed to figure it out, took way too long to find where to push migrations in the drizzle docs. Thanks for this anyway, its very helpful.
4 replies
DTDrizzle Team
Created by Zephury on 11/20/2023 in #help
I swear this infer was working... am I crazy?
try restarting ur ts server
14 replies