Joey9
Joey9
Explore posts from servers
TTCTheo's Typesafe Cult
Created by Joey9 on 4/23/2025 in #questions
T3 Env - Handle Dev vs Prod
so i should only store local and use prod in my deployment?
12 replies
TTCTheo's Typesafe Cult
Created by Joey9 on 4/23/2025 in #questions
T3 Env - Handle Dev vs Prod
would this be the correct approach when handling dev vs prod?
env.NODE_ENV === 'development' ? env.DEV_SUPABASE_URL : env.PROD_SUPABASE_URL
env.NODE_ENV === 'development' ? env.DEV_SUPABASE_URL : env.PROD_SUPABASE_URL
12 replies
TTCTheo's Typesafe Cult
Created by Joey9 on 4/23/2025 in #questions
T3 Env - Handle Dev vs Prod
adding dotenv package and doing import "dotenv/config"; in my env.ts made it work
12 replies
TTCTheo's Typesafe Cult
Created by Joey9 on 4/23/2025 in #questions
T3 Env - Handle Dev vs Prod
im using tanstack start, did the following:
//env.ts
import { createEnv } from "@t3-oss/env-core";
import { z } from "zod";

export const env = createEnv({
server: {
TEST: z.string(),
},
runtimeEnv: process.env,
emptyStringAsUndefined: true,
});
//env.ts
import { createEnv } from "@t3-oss/env-core";
import { z } from "zod";

export const env = createEnv({
server: {
TEST: z.string(),
},
runtimeEnv: process.env,
emptyStringAsUndefined: true,
});
//.env
TEST=test
//.env
TEST=test
then in my app.config.ts import "./env.ts"; and it errors when running pnpm dev
❌ Invalid environment variables: [
{
code: 'invalid_type',
expected: 'string',
received: 'undefined',
path: [ 'TEST' ],
message: 'Required'
}
]
❌ Invalid environment variables: [
{
code: 'invalid_type',
expected: 'string',
received: 'undefined',
path: [ 'TEST' ],
message: 'Required'
}
]
12 replies
TTCTheo's Typesafe Cult
Created by Joey9 on 4/23/2025 in #questions
T3 Env - Handle Dev vs Prod
12 replies
TTCTheo's Typesafe Cult
Created by Joey9 on 4/23/2025 in #questions
T3 Env - Handle Dev vs Prod
like if in prod use "these values" and if in dev use "these values"
12 replies
DTDrizzle Team
Created by Joey9 on 4/12/2025 in #help
Drizzle & Supabase
i got it working by doing this.
import { sql } from "drizzle-orm";
import { pgPolicy, pgTable, text, timestamp, uuid } from "drizzle-orm/pg-core";
import { authUsers } from "drizzle-orm/supabase";

export const users = pgTable(
"users",
{
id: uuid()
.primaryKey()
.notNull()
.references(() => authUsers.id, { onDelete: "cascade" }),
firstName: text(),
lasname: text(),
username: text(),
avatarUrl: text(),
createdAt: timestamp({ withTimezone: true, mode: "string" })
.defaultNow()
.notNull(),
email: text(),
},
(table) => [
pgPolicy("Users can update their own users table", {
as: "permissive",
for: "update",
to: ["public"],
using: sql`(( SELECT auth.uid() AS uid) = id)`,
}),
pgPolicy("Enable read access for all users", {
as: "permissive",
for: "select",
to: ["public"],
}),
pgPolicy("Enable insert for users based on id", {
as: "permissive",
for: "insert",
to: ["public"],
withCheck: sql`(( SELECT auth.uid() AS uid) = id)`,
}),
],
);
import { sql } from "drizzle-orm";
import { pgPolicy, pgTable, text, timestamp, uuid } from "drizzle-orm/pg-core";
import { authUsers } from "drizzle-orm/supabase";

export const users = pgTable(
"users",
{
id: uuid()
.primaryKey()
.notNull()
.references(() => authUsers.id, { onDelete: "cascade" }),
firstName: text(),
lasname: text(),
username: text(),
avatarUrl: text(),
createdAt: timestamp({ withTimezone: true, mode: "string" })
.defaultNow()
.notNull(),
email: text(),
},
(table) => [
pgPolicy("Users can update their own users table", {
as: "permissive",
for: "update",
to: ["public"],
using: sql`(( SELECT auth.uid() AS uid) = id)`,
}),
pgPolicy("Enable read access for all users", {
as: "permissive",
for: "select",
to: ["public"],
}),
pgPolicy("Enable insert for users based on id", {
as: "permissive",
for: "insert",
to: ["public"],
withCheck: sql`(( SELECT auth.uid() AS uid) = id)`,
}),
],
);
// relations.ts
import { relations } from "drizzle-orm/relations";

import { authUsers } from "drizzle-orm/supabase";
import { users } from "./schema/users";

export const usersRelations = relations(users, ({ one }) => ({
authUsers: one(authUsers, {
fields: [users.id],
references: [authUsers.id],
}),
}));

export const usersInAuthRelations = relations(authUsers, ({ one }) => ({
userProfile: one(users),
}));
// relations.ts
import { relations } from "drizzle-orm/relations";

import { authUsers } from "drizzle-orm/supabase";
import { users } from "./schema/users";

export const usersRelations = relations(users, ({ one }) => ({
authUsers: one(authUsers, {
fields: [users.id],
references: [authUsers.id],
}),
}));

export const usersInAuthRelations = relations(authUsers, ({ one }) => ({
userProfile: one(users),
}));
32 replies
DTDrizzle Team
Created by Joey9 on 4/12/2025 in #help
Drizzle & Supabase
alright, thanks again so much for the help
32 replies
DTDrizzle Team
Created by Joey9 on 4/12/2025 in #help
Drizzle & Supabase
also since the issues seem to be mostly with introspection, would you recommend i do create the tables through code then push to supabase. so do a codebase first approach?
32 replies
DTDrizzle Team
Created by Joey9 on 4/12/2025 in #help
Drizzle & Supabase
alright, thank you. I know its impossible to give timeframes, but do you have a best estimate on when these things(with supabase specifically) will become more stable?
32 replies
DTDrizzle Team
Created by Joey9 on 4/12/2025 in #help
Drizzle & Supabase
do you have any advice since theres quite a few issues right now? i really wanted to use drizzle but idk what to do now..
32 replies
DTDrizzle Team
Created by Joey9 on 4/12/2025 in #help
Drizzle & Supabase
this not looking good, might have to just end up using supabase orm...
32 replies
DTDrizzle Team
Created by Joey9 on 4/12/2025 in #help
Drizzle & Supabase
😢
32 replies
DTDrizzle Team
Created by Joey9 on 4/12/2025 in #help
Drizzle & Supabase
is this another bug? i made an issue for it just in case since im not sure. https://github.com/drizzle-team/drizzle-orm/issues/4407
32 replies
DTDrizzle Team
Created by Joey9 on 4/12/2025 in #help
Drizzle & Supabase
Alright... thanks for the answer
32 replies
DTDrizzle Team
Created by Joey9 on 4/12/2025 in #help
Drizzle & Supabase
yea i did: https://github.com/drizzle-team/drizzle-orm/issues/4405 is there anything i can do in the meantime 😦
32 replies
DTDrizzle Team
Created by Joey9 on 4/12/2025 in #help
Drizzle & Supabase
@Mario564 is this a bug? is there anything i can do?
32 replies
DTDrizzle Team
Created by Joey9 on 4/12/2025 in #help
Drizzle & Supabase
bump
32 replies
DTDrizzle Team
Created by Joey9 on 4/12/2025 in #help
Drizzle & Supabase
anyone?
32 replies