A Microcosm of the Macrocosm
A Microcosm of the Macrocosm
BABetter Auth
Created by A Microcosm of the Macrocosm on 4/13/2025 in #help
Custom Tables | SQL Schema
:nuxt: Help me understand how Better-Auth works with the DB. Better-Auth has its required core schema for the 4 core tables. For id uses string [I'm looking at the core schema] and the generated SQL gets a text type, for example. 1. If I create all tables on my own [Better-Auth Tables + other needed tables] and set that up at the DB level, does the auth instance still need to know about all of them, i.e. via me configuring the better-auth object [for a custom field I added on the user table] and creating my own plugin [for the extra tables]? 2. Also, if I, upon creating my DB tables, set the id PK field to uuid, will better-auth have problems with that? 3. On my user table, I (want to) have a user_type field which is a PostgreSQL Enum Type [just a couple of string options]. I can't set that on Better-Auth, as it only accepts string, number, etc. - is it okay for me, when configuring better-auth, to set the field type as string, when it is, in reality [at the DB level] an enum? 3. Does Better-Auth rely on the DB to auto, randomly generate the IDs or does it pass the id on every, say, user creation, for instance? I'm asking this because the SQL generated by Better-Auth is kinda different from what I'd like. So I was thinking of creating all tables on my own. But then I think I need to tell better-auth about them, and here comes the question about the Better-Auth accepted TS types vs PostgreSQL types I need. PS: I'm working with Nuxt, PostgreSQL, Drizzle ORM [though I'm trying to avoid the latter, if I can]
14 replies