Jokerz
Jokerz
Explore posts from servers
TTCTheo's Typesafe Cult
Created by Jokerz on 7/21/2024 in #questions
anyone running into failed to connect to daemon? i cant run pnpm dev
21/07/24 10:57:18] ➜ sol-eats git:(main) ✗ pnpm dev

> create-t3-turbo@ dev /Users/daniel/Documents/Repos/sol-eats
> turbo watch dev

• Packages in scope: @acme/api, @acme/auth, @acme/db, @acme/eslint-config, @acme/github, @acme/nextjs, @acme/prettier-config, @acme/tailwind-config, @acme/tsconfig, @acme/ui, @acme/validators
• Running dev in 11 packages
• Remote caching disabled
× failed to connect to daemon
╰─▶ server is unavailable: channel closed
21/07/24 10:57:18] ➜ sol-eats git:(main) ✗ pnpm dev

> create-t3-turbo@ dev /Users/daniel/Documents/Repos/sol-eats
> turbo watch dev

• Packages in scope: @acme/api, @acme/auth, @acme/db, @acme/eslint-config, @acme/github, @acme/nextjs, @acme/prettier-config, @acme/tailwind-config, @acme/tsconfig, @acme/ui, @acme/validators
• Running dev in 11 packages
• Remote caching disabled
× failed to connect to daemon
╰─▶ server is unavailable: channel closed
1 replies
DTDrizzle Team
Created by Jokerz on 2/15/2024 in #help
can we filter by a prop on a relation during a query?
eg. watch has watch brands + watch families as relations if i wanted to search across watch name, watch brand name + watch family name should that be possible? current query just using watch name
const items = await ctx.db.query.watch.findMany({
...withCursorPagination({
limit: 10,
cursors: [[schema.watchBrand.name, "desc", cursor]],
}),
where: and(
like(schema.watch.name, `%${input.name}%`),
notInArray(schema.watch.id, usersWatches),
),
with: {
watchBrand: true,
watchFamily: true,
},
});
const items = await ctx.db.query.watch.findMany({
...withCursorPagination({
limit: 10,
cursors: [[schema.watchBrand.name, "desc", cursor]],
}),
where: and(
like(schema.watch.name, `%${input.name}%`),
notInArray(schema.watch.id, usersWatches),
),
with: {
watchBrand: true,
watchFamily: true,
},
});
13 replies
DTDrizzle Team
Created by Jokerz on 10/2/2023 in #help
are timezones saved as utc? for pg
im having an issue where the db is saving -2 instead of -1
2 replies
RRailway
Created by Jokerz on 10/2/2023 in #✋|help
having issues with timezone
i have a simple defaultNow timestamp saving, but the db is giving the timestamp another hour behind? eg. saving data at 17:00 in bst, should be 16:00 in utc, but the db is giving 15:00
29 replies
DTDrizzle Team
Created by Jokerz on 7/8/2023 in #help
foreign key constraint cannot be implemented
/Users/daniel/Documents/Repos/Thatch/thatch-web/node_modules/.pnpm/[email protected]/node_modules/postgres/cjs/src/connection.js:771
const error = Errors.postgres(parseError(x))
^
PostgresError: foreign key constraint "users_to_posts_user_id_users_id_fk" cannot be implemented
/Users/daniel/Documents/Repos/Thatch/thatch-web/node_modules/.pnpm/[email protected]/node_modules/postgres/cjs/src/connection.js:771
const error = Errors.postgres(parseError(x))
^
PostgresError: foreign key constraint "users_to_posts_user_id_users_id_fk" cannot be implemented
import { relations } from "drizzle-orm";
import { pgTable, primaryKey, varchar } from "drizzle-orm/pg-core";

import { posts } from "./posts";
import { users } from "./users";

export const usersToPosts = pgTable(
"users_to_posts",
{
userId: varchar("user_id")
.notNull()
.references(() => users.id),
postId: varchar("post_id")
.notNull()
.references(() => posts.id),
},
(t) => ({
pk: primaryKey(t.userId, t.postId),
})
);

export const usersToPostsRelations = relations(usersToPosts, ({ one }) => ({
post: one(posts, {
fields: [usersToPosts.postId],
references: [posts.id],
}),
user: one(users, {
fields: [usersToPosts.userId],
references: [users.id],
}),
}));
import { relations } from "drizzle-orm";
import { pgTable, primaryKey, varchar } from "drizzle-orm/pg-core";

import { posts } from "./posts";
import { users } from "./users";

export const usersToPosts = pgTable(
"users_to_posts",
{
userId: varchar("user_id")
.notNull()
.references(() => users.id),
postId: varchar("post_id")
.notNull()
.references(() => posts.id),
},
(t) => ({
pk: primaryKey(t.userId, t.postId),
})
);

export const usersToPostsRelations = relations(usersToPosts, ({ one }) => ({
post: one(posts, {
fields: [usersToPosts.postId],
references: [posts.id],
}),
user: one(users, {
fields: [usersToPosts.userId],
references: [users.id],
}),
}));
2 replies
DTDrizzle Team
Created by Jokerz on 6/6/2023 in #help
When trying to push:mysql its warning that schema has changed and data will be lost when it hasnt.
· You're about to change projected_points column type from alter_table_alter_column_set_type to decimal with 689 items
THIS ACTION WILL CAUSE DATA LOSS AND CANNOT BE REVERTED
· You're about to change projected_points column type from alter_table_alter_column_set_type to decimal with 689 items
THIS ACTION WILL CAUSE DATA LOSS AND CANNOT BE REVERTED
No changes have been made ...
11 replies
RRailway
Created by Jokerz on 2/28/2023 in #✋|help
sorry, too many clients
Project ID: 3fad4fec-c497-4ecf-a107-dbd12bc4e047 Unable to load anything due to too many clients
4 replies
TTCTheo's Typesafe Cult
Created by Jokerz on 1/13/2023 in #questions
Vercel - Module not found: Can't resolve
On a new deployment I am getting a new error where I haven't changed anything at all in these files.
Failed to compile.
./src/pages/api/trpc/[trpc].ts
Module not found: Can't resolve '../../../server/api/root.js' in '/vercel/path0/src/pages/api/trpc'
./src/pages/api/trpc/[trpc].ts
Module not found: Can't resolve '../../../server/api/trpc.js' in '/vercel/path0/src/pages/api/trpc'
Failed to compile.
./src/pages/api/trpc/[trpc].ts
Module not found: Can't resolve '../../../server/api/root.js' in '/vercel/path0/src/pages/api/trpc'
./src/pages/api/trpc/[trpc].ts
Module not found: Can't resolve '../../../server/api/trpc.js' in '/vercel/path0/src/pages/api/trpc'
Here is the contents of my [trpc].ts
import { createNextApiHandler } from "@trpc/server/adapters/next";

import { env } from "../../../env/server.mjs";
import { appRouter } from "../../../server/api/root.js";
import { createTRPCContext } from "../../../server/api/trpc.js";

// export API handler
export default createNextApiHandler({
router: appRouter,
createContext: createTRPCContext,
onError:
env.NODE_ENV === "development"
? ({ path, error }) => {
console.error(
`❌ tRPC failed on ${path ?? "<no-path>"}: ${error.message}`
);
}
: undefined,
});
import { createNextApiHandler } from "@trpc/server/adapters/next";

import { env } from "../../../env/server.mjs";
import { appRouter } from "../../../server/api/root.js";
import { createTRPCContext } from "../../../server/api/trpc.js";

// export API handler
export default createNextApiHandler({
router: appRouter,
createContext: createTRPCContext,
onError:
env.NODE_ENV === "development"
? ({ path, error }) => {
console.error(
`❌ tRPC failed on ${path ?? "<no-path>"}: ${error.message}`
);
}
: undefined,
});
2 replies
TtRPC
Created by Jokerz on 11/8/2022 in #❓-help
How do we add settings in each query like before?
Since the new update, bee super confused. I used to do this, and can't recreate it now.
const {
data: traitz,
isLoading,
refetch: refetchTraitz,
} = trpc.useQuery(["trait.get-traits"], {
refetchOnWindowFocus: false,
enabled: !publicKey,
});
const {
data: traitz,
isLoading,
refetch: refetchTraitz,
} = trpc.useQuery(["trait.get-traits"], {
refetchOnWindowFocus: false,
enabled: !publicKey,
});
const {
data: traitz,
isLoading,
refetch: refetchTraitz,
} = trpc.trait.getTraits.useQuery();
const {
data: traitz,
isLoading,
refetch: refetchTraitz,
} = trpc.trait.getTraits.useQuery();
3 replies