DT
Drizzle Teamprabhatpal

Can I create tables at runtime?

Is it possible to create a user-specific schema and then generate tables within that schema when a user signs up?
Cris | Mailspace
Cris | Mailspace113d ago
any solutions on this?
Angelelz
Angelelz112d ago
This is an interesting problem. The way drizzle is currently setup is, it needs to have an schema to be able to infer all your types If you're creating tables, you should have the the shape of those tables already defined in your schema even if they don't exits I might be able to help with the workflow but I'd need to have more insights on the use case.
wolverine
wolverine89d ago
Hi, new to the discussion here. I made an accounting app using sveltekit and fastapi as backend. I had a main database which contained information regarding business i.e name, address, tax identifiers, sales identifiers, govt regulation identifiers e.t.c. Whenever a new business was created in the main database a new database associated with that particular business was created which contained tables for voucher entries, sales orders, purchase, inventory e.t.c. This can be achieved in a single sqlite db as well but lookup times are significantly better when each business has its own database which may contain thousands of records and its easier to keep backup of the data as well. I am planning to migrate my entire stack to javascript (drop fastapi and sqlmodel) as working with a separate fastapi backend litters my code with uncountable fetch requests. Sveltekit provides a super simple action api and if somehow i can create tables from my app for each individual business I will be a step closer to my goal. @Angelelz any thoughts?
Angelelz
Angelelz89d ago
Drizzle ORM - Goodies
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
Want results from more Discord servers?
Add your server
More Posts
Execute is not exist on a type LibSQLDatabaseconst url = env.TURSO_DB_URL if (url === undefined) { throw new Error('TURSO_DB_URL is not defTransactions, PgBouncer/Supavisor, prepared statementsokay... i have spent way to long trying to figure out why when using transactions and a pooler on trhow enable wal for sqlite with drizzle ?how enable wal for sqlite with drizzle ?Simple ForeignKey With statement not workingHi - I am attempting to use a with statement on a query and am getting this error: Cannot read propMySQL UUID as PKI am unable to get a PK setup which has a default UUID value. I have ```ts logID: varchar('logID'totalCount from relational queryis it somehow possible to get the total count of a relational query? Core queries aren't possible hCannot read properties of undefined (reading \'columns\')I tired using relational queries ` const bookmarkdb = drizzle(pool, { schema }); coDoes Drizzle support Microsoft SQL Server?Does Drizzle support Microsoft SQL Server ?Findfirst and Findmany configHello I am new to using drizzle and can't seem to make the findFirst and findMany work. I am using pTrouble running JEST testing in Hono for Cloudfare WorkersSo, I have an API setup in Hono with cloudfare workers and I setup the JEST tests but they don't seeHelp migrating a nested Prisma updateBeen trying to set this up without going through the raw sql route for some time but cant seem to wrWhich typescript type should I use for select?Hi, this question might be confusing. Let me explain the problem, I'm building a common function forpush:sqlite creating weird tablesWhen I run push:sqlite, tables like `__old_push_categories` are created and are automatically refrenUsing a placeholder with an inArrayI'm porting a query to a prepared statement, in the query I used to do something like: ``` .where(iDB insertion - Date field (mode: string) is using default value instead of passed valueTrying to insert an Order object which has a "pickupTime" Date field to db, but upon insertion the cBest practice on connections for PostgreSQLI got the following error; `remaining connection slots are reserved for non-replication superuser cMinimum value for Postgres bigserialI want my id tables to use bigserial, but i want the first row to be inserted with the value 222222.Prepend raw fields with table/subquery name in rendered SQLCurrently, it doesn't seem like raw fields in a select statement hold any information on the table/s