Gabriel Lucena
Gabriel Lucena
Explore posts from servers
DTDrizzle Team
Created by Gabriel Lucena on 11/18/2024 in #help
Running SQL statement manually for in-memory database
not sure what to do anymore to fix this, any ideas @opaldraggy?
25 replies
DTDrizzle Team
Created by Gabriel Lucena on 11/18/2024 in #help
Running SQL statement manually for in-memory database
No description
25 replies
DTDrizzle Team
Created by Gabriel Lucena on 11/18/2024 in #help
Running SQL statement manually for in-memory database
No description
25 replies
DTDrizzle Team
Created by Gabriel Lucena on 11/18/2024 in #help
Running SQL statement manually for in-memory database
migrate() function creating the session table:
25 replies
DTDrizzle Team
Created by Gabriel Lucena on 11/18/2024 in #help
Running SQL statement manually for in-memory database
No description
25 replies
DTDrizzle Team
Created by Gabriel Lucena on 11/18/2024 in #help
Running SQL statement manually for in-memory database
I've seem something like that in here: import { pushSQLiteSchema } from "drizzle-kit/api" but I did not find any docs on that
25 replies
DTDrizzle Team
Created by Gabriel Lucena on 11/18/2024 in #help
Running SQL statement manually for in-memory database
thank you so much for the help @opaldraggy
25 replies
DTDrizzle Team
Created by Gabriel Lucena on 11/18/2024 in #help
Running SQL statement manually for in-memory database
duh... I literally just:
sql.split("--> statement-breakpoint").forEach(async (sql) => {
const result = await db.run(sql)

console.log("result", result.toJSON())
})
sql.split("--> statement-breakpoint").forEach(async (sql) => {
const result = await db.run(sql)

console.log("result", result.toJSON())
})
25 replies
DTDrizzle Team
Created by Gabriel Lucena on 11/18/2024 in #help
Running SQL statement manually for in-memory database
or... do you have a better idea how to tackle this problem?
25 replies
DTDrizzle Team
Created by Gabriel Lucena on 11/18/2024 in #help
Running SQL statement manually for in-memory database
yep, that's exactly the issue, removing everything but the user table creation from the migration did the trick... now, how can I split those statements into multiple files?
25 replies
DTDrizzle Team
Created by Gabriel Lucena on 11/18/2024 in #help
Running SQL statement manually for in-memory database
got it. I'll try running only the users table creation to see what happens
25 replies
DTDrizzle Team
Created by Gabriel Lucena on 11/18/2024 in #help
Running SQL statement manually for in-memory database
so, the output from this:
const result = await db.run(sql)

console.log("result", result.toJSON())
const result = await db.run(sql)

console.log("result", result.toJSON())
is:
@app/server:dev: result {
@app/server:dev: columns: [],
@app/server:dev: columnTypes: [],
@app/server:dev: rows: [],
@app/server:dev: rowsAffected: 0,
@app/server:dev: lastInsertRowid: "0",
@app/server:dev: }
@app/server:dev: result {
@app/server:dev: columns: [],
@app/server:dev: columnTypes: [],
@app/server:dev: rows: [],
@app/server:dev: rowsAffected: 0,
@app/server:dev: lastInsertRowid: "0",
@app/server:dev: }
I'm not sure if DDL statements are included on the output, but it doesn't seem to be failing... so, I'm not sure what's going on
25 replies
DTDrizzle Team
Created by Gabriel Lucena on 11/18/2024 in #help
Running SQL statement manually for in-memory database
@opaldraggy
25 replies
DTDrizzle Team
Created by Gabriel Lucena on 11/18/2024 in #help
Running SQL statement manually for in-memory database
the drizzle error:
Query: select "id", "created_at", "confirmed_email", "confirmed_phone_number", "name", "email", "phone_country", "phone_country_code", "phone_number", "otp", "blocked" from "users" where "users"."email" like ? -- params: [""]
6 | rawCode;
7 | constructor(message, code, rawCode, cause) {
8 | if (code !== undefined) {
9 | message = `${code}: ${message}`;
10 | }
11 | super(message, { cause });
^
LibsqlError: SQLITE_ERROR: no such table: users
Query: select "id", "created_at", "confirmed_email", "confirmed_phone_number", "name", "email", "phone_country", "phone_country_code", "phone_number", "otp", "blocked" from "users" where "users"."email" like ? -- params: [""]
6 | rawCode;
7 | constructor(message, code, rawCode, cause) {
8 | if (code !== undefined) {
9 | message = `${code}: ${message}`;
10 | }
11 | super(message, { cause });
^
LibsqlError: SQLITE_ERROR: no such table: users
25 replies
DTDrizzle Team
Created by Gabriel Lucena on 11/18/2024 in #help
Running SQL statement manually for in-memory database
this is my only migration file, created by drizzle:
...
--> statement-breakpoint
CREATE TABLE `customers` (
`id` text PRIMARY KEY NOT NULL,
`workspace_id` text NOT NULL,
`created_at` integer NOT NULL,
`deleted_at` integer,
`name` text(100) NOT NULL,
`email` text(100) NOT NULL,
`phone_number` text(20),
`phone_country_code` text(10),
`document` text(100),
`status` text(255) NOT NULL,
`deleted` integer NOT NULL,
FOREIGN KEY (`workspace_id`) REFERENCES `workspaces`(`id`) ON UPDATE no action ON DELETE no action
);
--> statement-breakpoint
...
...
--> statement-breakpoint
CREATE TABLE `customers` (
`id` text PRIMARY KEY NOT NULL,
`workspace_id` text NOT NULL,
`created_at` integer NOT NULL,
`deleted_at` integer,
`name` text(100) NOT NULL,
`email` text(100) NOT NULL,
`phone_number` text(20),
`phone_country_code` text(10),
`document` text(100),
`status` text(255) NOT NULL,
`deleted` integer NOT NULL,
FOREIGN KEY (`workspace_id`) REFERENCES `workspaces`(`id`) ON UPDATE no action ON DELETE no action
);
--> statement-breakpoint
...
other tables are omitted
25 replies
DTDrizzle Team
Created by Gabriel Lucena on 11/18/2024 in #help
Running SQL statement manually for in-memory database
this is the output from await db.run(sql):
@app/server:dev: result {
@app/server:dev: columns: [],
@app/server:dev: columnTypes: [],
@app/server:dev: rows: [],
@app/server:dev: rowsAffected: 0,
@app/server:dev: lastInsertRowid: "0",
@app/server:dev: }
@app/server:dev: result {
@app/server:dev: columns: [],
@app/server:dev: columnTypes: [],
@app/server:dev: rows: [],
@app/server:dev: rowsAffected: 0,
@app/server:dev: lastInsertRowid: "0",
@app/server:dev: }
25 replies
DTDrizzle Team
Created by Gabriel Lucena on 5/31/2024 in #help
Help querying D1 with Drizzle
is there a technical reason why we don't have an adapter for D1? is this a D1's missing feature?
9 replies
TtRPC
Created by Gabriel Lucena on 5/10/2024 in #❓-help
How can I add React to SST's TRPC example?
who would've guessed that I could built it just reading the docs: https://github.com/gnllucena/trpc-sst
4 replies