chrisyalamov
chrisyalamov
Explore posts from servers
DTDrizzle Team
Created by chrisyalamov on 4/6/2025 in #help
Can't push migrations to Neon from a deno project (DNS error?)
I'm trying to push some migrations to a Neon database. Config for reference:
// drizzle.config.ts
import { defineConfig } from "drizzle-kit";

export default defineConfig({
dbCredentials: {
url: Deno.env.get("POSTGRES_DEFAULT_CONNSTRING") as string
},
dialect: "postgresql",
schema: "db/schema/*",
out: "db/migrations",
});
// drizzle.config.ts
import { defineConfig } from "drizzle-kit";

export default defineConfig({
dbCredentials: {
url: Deno.env.get("POSTGRES_DEFAULT_CONNSTRING") as string
},
dialect: "postgresql",
schema: "db/schema/*",
out: "db/migrations",
});
Running deno run --env -A --node-modules-dir npm:drizzle-kit generate --config ./db/drizzle.config.ts works fine and generates migrations. The following also works:
import { Pool } from 'npm:@neondatabase/serverless';
import { drizzle } from 'drizzle-orm/neon-serverless';

const pool = new Pool({
connectionString: Deno.env.get("POSTGRES_DEFAULT_CONNSTRING") as string
});

const db = drizzle({
client: pool
})

const res = await db.execute('select 1');
console.log(res)

export default db;
import { Pool } from 'npm:@neondatabase/serverless';
import { drizzle } from 'drizzle-orm/neon-serverless';

const pool = new Pool({
connectionString: Deno.env.get("POSTGRES_DEFAULT_CONNSTRING") as string
});

const db = drizzle({
client: pool
})

const res = await db.execute('select 1');
console.log(res)

export default db;
However, trying to actually push the migrations gives me this:
Reading config file '[***]/api/db/drizzle.config.ts'
Using 'pg' driver for database querying
[⣷] applying migrations...Error: getaddrinfo ENOTFOUND [***].eu-west-2.aws.neon.tech
at file:///[***]/api/node_modules/.deno/[email protected]/node_modules/pg-pool/index.js:45:11
at Object.runMicrotasks (ext:core/01_core.js:692:26)
at processTicksAndRejections (ext:deno_node/_next_tick.ts:59:10)
at runNextTicks (ext:deno_node/_next_tick.ts:76:3)
at eventLoopTick (ext:core/01_core.js:185:21)
at async PgDialect.migrate (file:///[***]/api/node_modules/.deno/[email protected]/node_modules/drizzle-orm/pg-core/dialect.js:54:5)
at async migrate (file:///[***]/api/node_modules/.deno/[email protected]/node_modules/drizzle-orm/node-postgres/migrator.js:4:3) {
errno: -3007,
code: "ENOTFOUND",
syscall: "getaddrinfo",
hostname: "[***].eu-west-2.aws.neon.tech"
}

[***] - redacted
Reading config file '[***]/api/db/drizzle.config.ts'
Using 'pg' driver for database querying
[⣷] applying migrations...Error: getaddrinfo ENOTFOUND [***].eu-west-2.aws.neon.tech
at file:///[***]/api/node_modules/.deno/[email protected]/node_modules/pg-pool/index.js:45:11
at Object.runMicrotasks (ext:core/01_core.js:692:26)
at processTicksAndRejections (ext:deno_node/_next_tick.ts:59:10)
at runNextTicks (ext:deno_node/_next_tick.ts:76:3)
at eventLoopTick (ext:core/01_core.js:185:21)
at async PgDialect.migrate (file:///[***]/api/node_modules/.deno/[email protected]/node_modules/drizzle-orm/pg-core/dialect.js:54:5)
at async migrate (file:///[***]/api/node_modules/.deno/[email protected]/node_modules/drizzle-orm/node-postgres/migrator.js:4:3) {
errno: -3007,
code: "ENOTFOUND",
syscall: "getaddrinfo",
hostname: "[***].eu-west-2.aws.neon.tech"
}

[***] - redacted
anyone have any idea why this is happening? 😩 btw, I have tried both the pooled and non-pooled connection strings.
2 replies
DTDrizzle Team
Created by chrisyalamov on 4/5/2025 in #help
Polymorphic relationships using a discriminator column
Hi all, I'm currently migrating (tbh rebuilding) a project that currently uses Entity Framework. In the database, we currently have a few polymorphic relationships, represented with a discriminator column. E.g. LicenseAssignments has a column LicenseTargetDiscriminator (which could be something like User, Organisation, Document, etc.) and a column LicenseTargetId which contains the ID of the resource in its particular table. (hope that made at least some sense) In EF, I can use "type hierarchy mapping" with a discriminator column https://learn.microsoft.com/en-us/ef/core/modeling/inheritance, so it can dynamically retrieve the linked records for me (and it knows which tables to pull them from, using the discriminator column). Is there any way to achieve this (or similar behaviour) in Drizzle?
1 replies
HHono
Created by chrisyalamov on 7/18/2024 in #help
Nested islands in HonoX
I'm trying to nest islands in fashion similar to this:
// islands/toggleSection.tsx
export const ToggleSection = (children, isOpen, onToggle) => {
// render accordion row if isOpen + button which fires onToggle
}

// islands/toggleSectionGroup.tsx
export const ToggleSectionGroup = (children) => {
const [focused, setFocused] = useState(-1);

// cloneElement() all children to pass props isOpen and onToggle
}

// routes/index.tsx
...
return <ToggleSectionGroup>
<ToggleSection />
<ToggleSection />
<ToggleSection />
</ToggleSectionGroup>
...
// islands/toggleSection.tsx
export const ToggleSection = (children, isOpen, onToggle) => {
// render accordion row if isOpen + button which fires onToggle
}

// islands/toggleSectionGroup.tsx
export const ToggleSectionGroup = (children) => {
const [focused, setFocused] = useState(-1);

// cloneElement() all children to pass props isOpen and onToggle
}

// routes/index.tsx
...
return <ToggleSectionGroup>
<ToggleSection />
<ToggleSection />
<ToggleSection />
</ToggleSectionGroup>
...
However, it appears that the inner islands end up rendering on the server. How could I approach this?
2 replies
HHono
Created by chrisyalamov on 6/30/2024 in #help
JSX Element type
I have a JSX component which should accept multiple children as props, however, using Element | Element[] (or ReactElement imported from hono/jsx) gives the following error when multiple children are passed:
Type 'Element' is not assignable to type 'ReactElement'.
Type 'HtmlEscapedString' is not assignable to type 'ReactElement'.
Type 'String & HtmlEscaped' is missing the following properties from type 'JSXNode': tag, props, children, type, and 2 more.ts(2322)
Type 'Element' is not assignable to type 'ReactElement'.
Type 'HtmlEscapedString' is not assignable to type 'ReactElement'.
Type 'String & HtmlEscaped' is missing the following properties from type 'JSXNode': tag, props, children, type, and 2 more.ts(2322)
Any ideas on how to accept multiple child elements?
4 replies