Shiba Bop
Shiba Bop
Explore posts from servers
DTDrizzle Team
Created by Shiba Bop on 6/23/2024 in #help
Drizzle Kit studio error
When I visit studio page, it keeps showing the spinner and the console has There is not enough information to infer relation "__public__.users_table.sessions_tables_user_id" error. my schema:
export const appSchema = pgSchema(process.env.SECURE_DB_SCHEMA);

export const userTable = pgTable('users_table', {
id: text('id').notNull().primaryKey(),
name: text('name').notNull(),
email: text('email').notNull().unique(),
password_hash: text('password_hash').notNull()
});

export const sessionTable = appSchema.table('sessions_table', {
id: text('id').primaryKey(),
userId: text('user_id')
.notNull()
.references(() => userTable.id),
expiresAt: timestamp('expires_at', {
withTimezone: true,
mode: 'date'
}).notNull()
});
export const appSchema = pgSchema(process.env.SECURE_DB_SCHEMA);

export const userTable = pgTable('users_table', {
id: text('id').notNull().primaryKey(),
name: text('name').notNull(),
email: text('email').notNull().unique(),
password_hash: text('password_hash').notNull()
});

export const sessionTable = appSchema.table('sessions_table', {
id: text('id').primaryKey(),
userId: text('user_id')
.notNull()
.references(() => userTable.id),
expiresAt: timestamp('expires_at', {
withTimezone: true,
mode: 'date'
}).notNull()
});
2 replies
SSolidJS
Created by Shiba Bop on 6/8/2024 in #support
access event.locals from a server function
Hey, I'm new to Solid.js and SolitStart. I'm trying to implement PocketBase auth and got middleware setup:
export default createMiddleware({
onRequest: [
async ({ locals, response, request }) => {
locals.pb = new PocketBase(process.env.SECURE_PB_URL);

locals.pb.authStore.loadFromCookie(
request.headers.get('cookie') || ''
);

try {
locals.pb.authStore.isValid &&
(await locals.pb.collection('users').authRefresh());
} catch {
locals.pb.authStore.clear();
}

response.headers.append(
'set-cookie',
locals.pb.authStore.exportToCookie()
);
}
]
});
export default createMiddleware({
onRequest: [
async ({ locals, response, request }) => {
locals.pb = new PocketBase(process.env.SECURE_PB_URL);

locals.pb.authStore.loadFromCookie(
request.headers.get('cookie') || ''
);

try {
locals.pb.authStore.isValid &&
(await locals.pb.collection('users').authRefresh());
} catch {
locals.pb.authStore.clear();
}

response.headers.append(
'set-cookie',
locals.pb.authStore.exportToCookie()
);
}
]
});
is it possible to access event.locals inside a server function?
7 replies