Paddy
Paddy
Explore posts from servers
DTDrizzle Team
Created by Paddy on 3/6/2024 in #help
Make two columns unique (composite primary key)
Hey everyone, I need to make the provider_id and provider_user_id to be unique together (composite primary key). After migration it returns that it is not allowed to have multiple primary keys. But it does seem to be the way Drizzle ORM want it to work, I think. Anyone in here that encountered this before with TypeScript, Drizzle ORM?
export const oauthAccount = pgTable(
'oath_account',
{
provider_id: text('provider_id').notNull(),
provider_user_id: text('provider_user_id').notNull(),
user_id: text('user_id')
.notNull()
.references(() => users.id),
},
(table) => {
return {
pk: primaryKey({
columns: [table.provider_id, table.provider_user_id],
}),
};
}
);
export const oauthAccount = pgTable(
'oath_account',
{
provider_id: text('provider_id').notNull(),
provider_user_id: text('provider_user_id').notNull(),
user_id: text('user_id')
.notNull()
.references(() => users.id),
},
(table) => {
return {
pk: primaryKey({
columns: [table.provider_id, table.provider_user_id],
}),
};
}
);
Thank you in advance!
2 replies
DTDrizzle Team
Created by Paddy on 3/5/2024 in #help
Drizzle-kit: Uncomment code below and paste pk name manually?
No description
1 replies
DTDrizzle Team
Created by Paddy on 3/4/2024 in #help
Composite primary key, multiple primary keys
I am following the Lucia-auth docs for multiple oauth providers, it's says: PRIMARY KEY (provider_id, provider_user_id) as shown here: https://lucia-auth.com/guides/oauth/multiple-providers I am using Postgres with TypeScript so I made it like this, instead of the SQLite example they use.
export const oauthAccount = pgTable(
'oath_account',
{
provider_id: text('provider_id').notNull(),
provider_user_id: text('provider_user_id').notNull(),
user_id: text('user_id')
.notNull()
.references(() => users.id),
},
(table) => {
return {
pk: primaryKey({
columns: [table.provider_id, table.provider_user_id],
}),
};
}
);
export const oauthAccount = pgTable(
'oath_account',
{
provider_id: text('provider_id').notNull(),
provider_user_id: text('provider_user_id').notNull(),
user_id: text('user_id')
.notNull()
.references(() => users.id),
},
(table) => {
return {
pk: primaryKey({
columns: [table.provider_id, table.provider_user_id],
}),
};
}
);
Its returning in the terminal: multiple primary keys for table "oath_account" are not allowed.. But in the docs it shows I need it, right, what am I doing wrong? Thanks in advance.
4 replies
PD🧩 Plasmo Developers
Created by Paddy on 2/12/2024 in #👟framework
Options and popup extension pages both working?
Hey, I got the Supabase options authentication, but I want after authentication also the popup to be working, how do I get the popup to work and the options page to work at the same time as currently its only one or the other. Thank you in advance.
2 replies
PD🧩 Plasmo Developers
Created by Paddy on 2/8/2024 in #👟framework
Adding Supabase later instead of starting with it?
Hey everyone, I started a Plasmo project initially --with-nextjs, now I want to use the Messaging API to communicate with my Supabase REST API, could I follow the docs of Supabase Plasmo afterwards or do I have to start with the --with-supabase to make this properly work? Best regards.
6 replies
PD🧩 Plasmo Developers
Created by Paddy on 2/8/2024 in #👾extension
How to send API requests with messaging?
No description
18 replies
TtRPC
Created by Paddy on 1/18/2024 in #❓-help
Kirimase's tRPC usage CRUD route
No description
2 replies
TtRPC
Created by Paddy on 1/12/2024 in #❓-help
tRPC won't return route with function, only JSON
No description
6 replies
TtRPC
Created by Paddy on 1/12/2024 in #❓-help
tRPC router won't return, unless it's just json.
Hey all, Why can I go to 'test' and the 'This is a test!' is being returned, but when I try to go to another router it returns this big error, 404, meaning that it doesn't even exist, right? While the function does exist. Would love to hear from someone! 🙂 Best regards.
2 replies
TtRPC
Created by Paddy on 1/10/2024 in #❓-help
Node 20, NPM: Send form values to DB with tRPC?
No description
5 replies
TTCTheo's Typesafe Cult
Created by Paddy on 11/16/2023 in #questions
'Correct' Development use, Folder Structure in T3 Tech Stack App
Dear community, I've used the Interactive CLI to start a full-stack, typesafe Next.js app. I got a couple questions regarding the 'correct' development use/folder structure for this. Question #1 Do I use the components folder only for components like a button & card, or also for file – e.g. a navbar & footer? Question #2 I am reading Routing > Pages and Layouts to understand how, this structuring works. In my use-case I would prefer to have a static navbar & footer in layout.tsx, so they won't re-render every time, right, as I am understanding? Source: https://nextjs.org/docs/app/building-your-application/routing/pages-and-layouts#nesting-layouts Please let me know, if you need any more information. I would love to receive sources e.g. doc's or tutorials to study, if you have any to share, of course. 🙂 Thank you so much! Best regards.
5 replies