Lautaro_dapin
Lautaro_dapin
Explore posts from servers
DTDrizzle Team
Created by Mendy on 7/15/2023 in #help
How to update multiple rows with one query?
most orms use CASE WHEN for updating you could investigate that
6 replies
DTDrizzle Team
Created by hachoter on 6/11/2023 in #help
I need some guidance on joins
the doc doesn't specified that, but it seems that is oonly a layer on top of the oooriginal lib, so it should you could add a logger on your db and see it for yourself
7 replies
DTDrizzle Team
Created by hachoter on 6/11/2023 in #help
I need some guidance on joins
and this is new https://orm.drizzle.team/docs/rqb#querying maybe that helps
7 replies
DTDrizzle Team
Created by hachoter on 6/11/2023 in #help
I need some guidance on joins
no way of doinng that, thats how sql works, its just a row, youu will have to do a reduce or map after that
7 replies
DTDrizzle Team
Created by Lautaro_dapin on 6/6/2023 in #help
Sveltekit Failed to resolve import "cloudflare:sockets"
@Maston lool, i'm so stupid, i was putting the load function in the server/cliennt instead of the page.server.ts xD
7 replies
DTDrizzle Team
Created by Lautaro_dapin on 6/6/2023 in #help
Sveltekit Failed to resolve import "cloudflare:sockets"
I will try that thanks
7 replies
DTDrizzle Team
Created by Lautaro_dapin on 6/6/2023 in #help
Sveltekit Failed to resolve import "cloudflare:sockets"
The project is only a svelkite project template with the following changes
// routes/+page.ts
import type { PageLoad } from "./$types";
import { db } from "$lib/drizzle"

export const load: PageLoad = ({ fetch })
return { hola: "mundo" }
}
// routes/+page.ts
import type { PageLoad } from "./$types";
import { db } from "$lib/drizzle"

export const load: PageLoad = ({ fetch })
return { hola: "mundo" }
}
// lib/drizzle.ts
import { pgTable, serial, text, varchar, integer } from "drizzle-orm/pg-core";
import { drizzle } from "drizzle-orm/node-postgres"
import { Pool } from "pg"
import { migrate } from "drizzle-orm/node-postgres/migrator"

export const kanbanColumns = pgTable('kanban_columns', {
id: serial('id').primaryKey(),
name: text('name').notNull(),
order: integer('order').notNull().default(0),
})

export const kanbanTickets = pgTable('kanban_tickets', {
id: serial('id').primaryKey(),
title: text('name').notNull(),
order: integer('order').notNull().default(0),
columnId: integer('column_id').references(() => kanbanColumns.id)
})

const sqlite = new Pool({
host: '127.0.0.1',
port: 5450,
user: "postgres",
password: "example",

})
export const db = drizzle(sqlite);


migrate(db, { migrationsFolder: "migrations" });
// lib/drizzle.ts
import { pgTable, serial, text, varchar, integer } from "drizzle-orm/pg-core";
import { drizzle } from "drizzle-orm/node-postgres"
import { Pool } from "pg"
import { migrate } from "drizzle-orm/node-postgres/migrator"

export const kanbanColumns = pgTable('kanban_columns', {
id: serial('id').primaryKey(),
name: text('name').notNull(),
order: integer('order').notNull().default(0),
})

export const kanbanTickets = pgTable('kanban_tickets', {
id: serial('id').primaryKey(),
title: text('name').notNull(),
order: integer('order').notNull().default(0),
columnId: integer('column_id').references(() => kanbanColumns.id)
})

const sqlite = new Pool({
host: '127.0.0.1',
port: 5450,
user: "postgres",
password: "example",

})
export const db = drizzle(sqlite);


migrate(db, { migrationsFolder: "migrations" });
couldnt figure up what was happening, I event add the cloudflare adaptor to the sveltekit.config.ts
// import adapter from '@sveltejs/adapter-auto';
import adapter from '@sveltejs/adapter-cloudflare';

import { vitePreprocess } from '@sveltejs/kit/vite';

/** @type {import('@sveltejs/kit').Config} */
const config = {
preprocess: vitePreprocess(),

kit: {
adapter: adapter(),
}
};

export default config;
// import adapter from '@sveltejs/adapter-auto';
import adapter from '@sveltejs/adapter-cloudflare';

import { vitePreprocess } from '@sveltejs/kit/vite';

/** @type {import('@sveltejs/kit').Config} */
const config = {
preprocess: vitePreprocess(),

kit: {
adapter: adapter(),
}
};

export default config;
7 replies