bobmusinex
bobmusinex
DTDrizzle Team
Created by bobmusinex on 10/21/2024 in #help
Type Error when inserting into table
Always the little things...
8 replies
DTDrizzle Team
Created by bobmusinex on 10/21/2024 in #help
Type Error when inserting into table
Ok, fixed it. The alias wasn't the probably, it's just rendered to a plaintext filepath. The issue was import db should have been import { db }.
8 replies
DTDrizzle Team
Created by bobmusinex on 10/21/2024 in #help
Type Error when inserting into table
For context, $lib is a built-in SvelteKit alias. It works elsewhere in my project. I'm able to successfully query data.
8 replies
DTDrizzle Team
Created by bobmusinex on 10/21/2024 in #help
Type Error when inserting into table
import db from '$lib/db/db';
8 replies
DTDrizzle Team
Created by bobmusinex on 10/21/2024 in #help
Type Error when inserting into table
export const db = drizzle('./src/lib/db/sqlite.db');
8 replies
DTDrizzle Team
Created by bobmusinex on 10/18/2024 in #help
Drizzle Studio fails to run due to TypeError
Thanks!!
6 replies
DTDrizzle Team
Created by bobmusinex on 10/18/2024 in #help
Drizzle Studio fails to run due to TypeError
Goodness, that was easy...
6 replies
DTDrizzle Team
Created by bobmusinex on 10/18/2024 in #help
Drizzle Studio fails to run due to TypeError
bump
6 replies
DTDrizzle Team
Created by bobmusinex on 10/18/2024 in #help
Drizzle Studio fails to run due to TypeError
and here is the file that is being flagged in the error (it's the new tables added)
import { text, integer, sqliteTable } from 'drizzle-orm/sqlite-core';
import { relations } from 'drizzle-orm';

export const users = sqliteTable('users', {
id: text('id').primaryKey()
});

export const sessions = sqliteTable('sessions', {
id: text('id').primaryKey(),
userId: text('user_id')
.notNull()
.references(() => users.id),
expiresAt: integer('expires_at').notNull()
});

export const usersRelations = relations(users, ({ many }) => ({
sessions: many(sessions)
}));

export const sessionsRelations = relations(sessions, ({ one }) => ({
user: one(users, {
field: [sessions.userId],
references: [users.id]
})
}));
import { text, integer, sqliteTable } from 'drizzle-orm/sqlite-core';
import { relations } from 'drizzle-orm';

export const users = sqliteTable('users', {
id: text('id').primaryKey()
});

export const sessions = sqliteTable('sessions', {
id: text('id').primaryKey(),
userId: text('user_id')
.notNull()
.references(() => users.id),
expiresAt: integer('expires_at').notNull()
});

export const usersRelations = relations(users, ({ many }) => ({
sessions: many(sessions)
}));

export const sessionsRelations = relations(sessions, ({ one }) => ({
user: one(users, {
field: [sessions.userId],
references: [users.id]
})
}));
6 replies