potato
potato
Explore posts from servers
DTDrizzle Team
Created by potato on 11/11/2023 in #help
Can't figure out this simple one-to-many relationship
I did this instead: export const villageRelations = relations(village, ({ many }) => ({ patients: many(patient), })); please advice if this is correct?
2 replies
TTCTheo's Typesafe Cult
Created by potato on 5/13/2023 in #questions
Syntax help for useQuery with no inputs
much appreciated thank you, i ended up wrapping both queries in the route anyway with a transaction, but still helpful to know 🙂
3 replies
DTDrizzle Team
Created by potato on 4/10/2023 in #help
[BUG] drizzle-kit doesn't like imports outside of a module
Found Github Issue here: https://github.com/drizzle-team/drizzle-kit-mirror/issues/21, if anybody has a workaround for now, please let me know 🙂
24 replies
DTDrizzle Team
Created by potato on 4/10/2023 in #help
[BUG] drizzle-kit doesn't like imports outside of a module
Can't generate my sql queries unless someone has a temporary workaround
24 replies
DTDrizzle Team
Created by potato on 4/10/2023 in #help
drizzle-kit throwing await is not available in the configured target environment
never mind, fixed it (t3 stack doesnt have top-level await configured by default), however ran into the import zod issue with the environment variables
5 replies
DTDrizzle Team
Created by potato on 4/10/2023 in #help
drizzle-kit throwing await is not available in the configured target environment
Complete error code:❌ Error: Transform failed with 2 errors: C:\Users\Abdul\Documents\GitHub\bodyshop-mgmt\src\db\db.ts:13:0: ERROR: Top-level await is not available in the configured target environment ("node14") C:\Users\Abdul\Documents\GitHub\bodyshop-mgmt\src\db\db.ts:17:21: ERROR: Top-level await is not available in the configured target environment ("node14") at failureErrorWithLog (C:\Users\Abdul\Documents\GitHub\bodyshop-mgmt\node_modules\esbuild\lib\main.js:1575:15) at C:\Users\Abdul\Documents\GitHub\bodyshop-mgmt\node_modules\esbuild\lib\main.js:814:29 at responseCallbacks.<computed> (C:\Users\Abdul\Documents\GitHub\bodyshop-mgmt\node_modules\esbuild\lib\main.js:680:9) at handleIncomingPacket (C:\Users\Abdul\Documents\GitHub\bodyshop-mgmt\node_modules\esbuild\lib\main.js:735:9) at Socket.readFromStdout (C:\Users\Abdul\Documents\GitHub\bodyshop-mgmt\node_modules\esbuild\lib\main.js:656:7) at Socket.emit (node:events:513:28) at addChunk (node:internal/streams/readable:324:12) at readableAddChunk (node:internal/streams/readable:297:9) at Readable.push (node:internal/streams/readable:234:10) at Pipe.onStreamRead (node:internal/stream_base_commons:190:23) { errors: [ { detail: undefined, id: '', location: [Object], notes: [], pluginName: '', text: 'Top-level await is not available in the configured target environment ("node14")' }, { detail: undefined, id: '', location: [Object], notes: [], pluginName: '', text: 'Top-level await is not available in the configured target environment ("node14")' } ], warnings: [] }
5 replies
DTDrizzle Team
Created by potato on 4/10/2023 in #help
drizzle-kit throwing await is not available in the configured target environment
DB.ts code: 🤠 // db.ts import { pgTable, serial, text, varchar } from 'drizzle-orm/pg-core'; import { drizzle } from 'drizzle-orm/node-postgres'; import { Client } from 'pg'; import { env } from "../env.mjs"; import { countries } from './schema'; const client = new Client({ connectionString: env.POSTGRES_URL, }); await client.connect(); const db = drizzle(client); const allCountries = await db.select().from(countries);
5 replies
DTDrizzle Team
Created by potato on 4/10/2023 in #help
drizzle-kit throwing await is not available in the configured target environment
Schema Code: 🫡 import { pgEnum, pgTable, serial, integer, uniqueIndex, varchar } from 'drizzle-orm/pg-core'; // declaring enum in database export const popularityEnum = pgEnum('popularity', ['unknown', 'known', 'popular']); export const countries = pgTable('countries', { id: serial('id').primaryKey(), name: varchar('name', { length: 256 }), }, (countries) => { return { nameIndex: uniqueIndex('name_idx').on(countries.name), } }); export const cities = pgTable('cities', { id: serial('id').primaryKey(), name: varchar('name', { length: 256 }), countryId: integer('country_id').references(() => countries.id), popularity: popularityEnum('popularity'), });
5 replies