Samir
Samir
Explore posts from servers
DTDrizzle Team
Created by Samir on 4/2/2024 in #help
Issue with push command
No description
2 replies
DTDrizzle Team
Created by Samir on 12/16/2023 in #help
Migration issue with PostgresSQL
I'm trying to migrate
export const postLikeTable = pgTable(
"post_like",
{
postId: text("post_id")
.references(() => postTable.id, { onDelete: "cascade" })
.notNull(),
userId: text("user_id")
.references(() => userTable.id, { onDelete: "cascade" })
.notNull(),
},
(self) => ({
pk: primaryKey({ columns: [self.postId, self.userId] }),
})
);
export const postLikeTable = pgTable(
"post_like",
{
postId: text("post_id")
.references(() => postTable.id, { onDelete: "cascade" })
.notNull(),
userId: text("user_id")
.references(() => userTable.id, { onDelete: "cascade" })
.notNull(),
},
(self) => ({
pk: primaryKey({ columns: [self.postId, self.userId] }),
})
);
But it says PostgresError: foreign key constraint "post_like_post_id_post_id_fk" cannot be implemented code: "42804"
3 replies
DTDrizzle Team
Created by Samir on 10/26/2023 in #help
How would I get 2 unique values?
I got my post likes table.
export const postLike = sqliteTable(
"post_like",
{
postId: text("post_id")
.notNull()
.primaryKey()
.references(() => post.id),

userId: text("user_id")
.notNull()
.references(() => user.id),
},
(self) => ({
unq: unique("unique_post_likes").on(self.postId, self.userId),
})
);
export const postLike = sqliteTable(
"post_like",
{
postId: text("post_id")
.notNull()
.primaryKey()
.references(() => post.id),

userId: text("user_id")
.notNull()
.references(() => user.id),
},
(self) => ({
unq: unique("unique_post_likes").on(self.postId, self.userId),
})
);
But if I already have same post id with different user. It returns error "LibsqlError: SQLITE_CONSTRAINT: SQLite error: UNIQUE constraint failed: post_like.post_id"
7 replies
DTDrizzle Team
Created by Samir on 10/19/2023 in #help
Issue with DOM element types
When I install drizzle-orm to my NextJS app (app dir). It ruins typescript types of DOM elements.
11 replies