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
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
DTDrizzle Team
Created by Samir on 10/19/2023 in #help
Issue with DOM element types
I should get typings at least? But same issue in client components
11 replies
DTDrizzle Team
Created by Samir on 10/19/2023 in #help
Issue with DOM element types
My package.json
{
"name": "supgrade",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@hookform/resolvers": "^3.3.2",
"@libsql/client": "^0.3.5",
"@lucia-auth/adapter-sqlite": "^2.0.1",
"@radix-ui/react-accordion": "^1.1.2",
"@radix-ui/react-avatar": "^1.0.4",
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-dropdown-menu": "^2.0.6",
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-label": "^2.0.2",
"@radix-ui/react-select": "^2.0.0",
"@radix-ui/react-slot": "^1.0.2",
"@radix-ui/react-toast": "^1.1.5",
"class-variance-authority": "^0.7.0",
"clsx": "^2.0.0",
"drizzle-orm": "^0.28.6",
"lucia": "^2.7.1",
"lucide-react": "^0.288.0",
"next": "13.5.6",
"next-themes": "^0.2.1",
"pocketbase": "^0.19.0",
"react": "^18",
"react-dom": "^18",
"react-hook-form": "^7.47.0",
"tailwind-merge": "^1.14.0",
"tailwindcss-animate": "^1.0.7",
"zod": "^3.22.4"
},
"devDependencies": {
"@total-typescript/ts-reset": "^0.5.1",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"autoprefixer": "^10",
"drizzle-kit": "^0.19.13",
"eslint": "^8",
"eslint-config-next": "13.5.6",
"postcss": "^8",
"tailwindcss": "^3",
"typescript": "^5"
}
}
{
"name": "supgrade",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@hookform/resolvers": "^3.3.2",
"@libsql/client": "^0.3.5",
"@lucia-auth/adapter-sqlite": "^2.0.1",
"@radix-ui/react-accordion": "^1.1.2",
"@radix-ui/react-avatar": "^1.0.4",
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-dropdown-menu": "^2.0.6",
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-label": "^2.0.2",
"@radix-ui/react-select": "^2.0.0",
"@radix-ui/react-slot": "^1.0.2",
"@radix-ui/react-toast": "^1.1.5",
"class-variance-authority": "^0.7.0",
"clsx": "^2.0.0",
"drizzle-orm": "^0.28.6",
"lucia": "^2.7.1",
"lucide-react": "^0.288.0",
"next": "13.5.6",
"next-themes": "^0.2.1",
"pocketbase": "^0.19.0",
"react": "^18",
"react-dom": "^18",
"react-hook-form": "^7.47.0",
"tailwind-merge": "^1.14.0",
"tailwindcss-animate": "^1.0.7",
"zod": "^3.22.4"
},
"devDependencies": {
"@total-typescript/ts-reset": "^0.5.1",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"autoprefixer": "^10",
"drizzle-kit": "^0.19.13",
"eslint": "^8",
"eslint-config-next": "13.5.6",
"postcss": "^8",
"tailwindcss": "^3",
"typescript": "^5"
}
}
11 replies
DTDrizzle Team
Created by Samir on 10/19/2023 in #help
Issue with DOM element types
thats nextjs app (app dir). I tried restarting ts server of vscode and even vscode. Tried it with Neovim. Same issue
11 replies
DTDrizzle Team
Created by Samir on 10/19/2023 in #help
Issue with DOM element types
My tsconfig.json
{
"compilerOptions": {
"target": "es6",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"paths": {
"@/*": ["./*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}
{
"compilerOptions": {
"target": "es6",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"paths": {
"@/*": ["./*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}
11 replies
DTDrizzle Team
Created by Samir on 10/19/2023 in #help
Issue with DOM element types
No description
11 replies
DTDrizzle Team
Created by Samir on 10/19/2023 in #help
Issue with DOM element types
No description
11 replies