Samir
Samir
Explore posts from servers
DTDrizzle Team
Created by Samir on 4/2/2024 in #help
Issue with push command
Some verbose output:
Warning You are about to execute current statements:

ALTER TABLE `links_visitor` DROP PRIMARY KEY;
ALTER TABLE `links` MODIFY COLUMN `created_at` timestamp DEFAULT (now());
ALTER TABLE `links_visitor` MODIFY COLUMN `viewed_at` timestamp DEFAULT (now());
ALTER TABLE `user` MODIFY COLUMN `created_at` timestamp DEFAULT (now());
ALTER TABLE `links_visitor` ADD PRIMARY KEY(`link_id`,`ip`);
Warning You are about to execute current statements:

ALTER TABLE `links_visitor` DROP PRIMARY KEY;
ALTER TABLE `links` MODIFY COLUMN `created_at` timestamp DEFAULT (now());
ALTER TABLE `links_visitor` MODIFY COLUMN `viewed_at` timestamp DEFAULT (now());
ALTER TABLE `user` MODIFY COLUMN `created_at` timestamp DEFAULT (now());
ALTER TABLE `links_visitor` ADD PRIMARY KEY(`link_id`,`ip`);
2 replies
DTDrizzle Team
Created by Samir on 12/16/2023 in #help
Migration issue with PostgresSQL
Found the issue. It was happening because of incompatible types: text and uuid
3 replies
DTDrizzle Team
Created by Samir on 12/16/2023 in #help
Migration issue with PostgresSQL
My post and user table looks like
export const postTable = pgTable("post", {
id: uuid("id").defaultRandom().primaryKey(),

title: varchar("title", { length: 50 }).unique().notNull(),
content: varchar("content", { length: 1000 }).notNull(),
price: doublePrecision("price").default(0),

createdAt: timestamp("created_at", {
precision: 2,
withTimezone: true,
}).defaultNow(),

userId: text("user_id")
.references(() => userTable.id, { onDelete: "cascade" })
.notNull(),
});
export const postTable = pgTable("post", {
id: uuid("id").defaultRandom().primaryKey(),

title: varchar("title", { length: 50 }).unique().notNull(),
content: varchar("content", { length: 1000 }).notNull(),
price: doublePrecision("price").default(0),

createdAt: timestamp("created_at", {
precision: 2,
withTimezone: true,
}).defaultNow(),

userId: text("user_id")
.references(() => userTable.id, { onDelete: "cascade" })
.notNull(),
});
export const userTable = pgTable("user", {
id: text("id").primaryKey(),
username: varchar("username", { length: 20 }).notNull().unique(),
role: userRoleEnum("role"),
cash: doublePrecision("cash").default(0),
});
export const userTable = pgTable("user", {
id: text("id").primaryKey(),
username: varchar("username", { length: 20 }).notNull().unique(),
role: userRoleEnum("role"),
cash: doublePrecision("cash").default(0),
});
3 replies
CDCloudflare Developers
Created by Samir on 12/13/2023 in #general-help
Site's metadata with WAF protection
There was known bot thing. I disabled it and it worked!
7 replies
CDCloudflare Developers
Created by Samir on 12/13/2023 in #general-help
Site's metadata with WAF protection
How you mean
7 replies
CDCloudflare Developers
Created by Samir on 12/13/2023 in #general-help
Site's metadata with WAF protection
My current rule looks like (ip.geoip.country eq "T1") or (cf.threat_score gt 0) or (not cf.tls_client_auth.cert_verified) or (cf.client.bot)
7 replies
DTDrizzle Team
Created by Samir on 10/26/2023 in #help
How would I get 2 unique values?
const latestPosts = await db
.select()
.from(post)
.limit(15)
.innerJoin(user, eq(user.id, post.userId))
.innerJoin(category, eq(category.slug, post.categorySlug))
.fullJoin(postLike, eq(postLike.postId, post.id))
.orderBy(desc(post.createdAt));
const latestPosts = await db
.select()
.from(post)
.limit(15)
.innerJoin(user, eq(user.id, post.userId))
.innerJoin(category, eq(category.slug, post.categorySlug))
.fullJoin(postLike, eq(postLike.postId, post.id))
.orderBy(desc(post.createdAt));
on line 7: Im attaching post like. How would I get them in an array? Or is there any way to just get the count of it?
7 replies
DTDrizzle Team
Created by Samir on 10/26/2023 in #help
How would I get 2 unique values?
Thank you so much!
7 replies