Ganbatte
Ganbatte
Explore posts from servers
DTDrizzle Team
Created by Ganbatte on 11/9/2024 in #help
Issues Using RLS with Supabase Through Drizzle
No description
4 replies
DTDrizzle Team
Created by Ganbatte on 10/28/2024 in #help
How to Handle Incorrect Schema Generation with Drizzle?
Hi everyone! What is the usual practice when I generate an incorrect schema with Drizzle and can't successfully migrate? Is there a command to delete the previous migration/generation? Because no matter what I change afterward, it keeps throwing the same error. For example, I have two tables that I linked together, but I later noticed that one has an int column and the other has text. Even if I fix the schema, regenerate it, and try to migrate again, it still throws the same error. How should I properly handle this? Thanks in advance! Error example: severity_local: 'ERROR', severity: 'ERROR', code: '42804', detail: 'Key columns "dishID" and "id" are of incompatible types: integer and text.', where: 'SQL statement "ALTER TABLE "topping_dish" ADD CONSTRAINT "topping_dish_dishID_dish_id_fk" FOREIGN KEY ("dishID") REFERENCES "public"."dish"("id") ON DELETE cascade ON UPDATE no action"\n' + 'PL/pgSQL function inline_code_block line 2 at SQL statement', file: 'tablecmds.c', line: '9339', routine: 'ATAddForeignKeyConstraint'
1 replies
DTDrizzle Team
Created by Ganbatte on 10/25/2024 in #help
Middleware Issues in Next.js Using Drizzle, Supabase, and NextAuth
No description
9 replies
DTDrizzle Team
Created by Ganbatte on 8/14/2024 in #help
Help Needed with Drizzlekit Migration Issue
I've encountered an issue where I manually deleted a table in Drizzlekit Studio using DROP TABLE "orderProduct". This was due to a bug inside my orderProduct where I had both an "orders" and "order" column, each referencing the "orders" table, and I couldn't remove them. I'm not fully understanding how migrations work in Drizzlekit, which is why I'm reaching out. When I run bunx drizzle-kit generate and migrate, the table isn't being regenerated along with its relations. Bunx drizzle-kit generate output: 14 tables orderProduct 5 columns 0 indexes 3 fks orders 7 columns 0 indexes 1 fks ..... No schema changes, nothing to migrate 😴 Bunx drizzle-kit migrate output: No config path provided, using default 'drizzle.config.ts' Reading config file 'C:\...\drizzle.config.ts' Using 'postgres' driver for database querying [⣟] applying migrations...{ severity_local: 'NOTICE', severity: 'NOTICE', code: '42P06', message: 'schema "drizzle" already exists, skipping', file: 'schemacmds.c', line: '132', routine: 'CreateSchemaCommand' } { severity_local: 'NOTICE', severity: 'NOTICE', code: '42P07', message: 'relation "__drizzle_migrations" already exists, skipping', file: 'parse_utilcmd.c', line: '207', routine: 'transformCreateStmt' } [⡿] applying migrations...PostgresError: relation "orderProduct" does not exist severity_local: 'ERROR', severity: 'ERROR', code: '42P01', file: 'namespace.c', line: '434', routine: 'RangeVarGetRelidExtended' } error: script "migrate" exited with code 1 How can I fix this? The schema clearly defines what should be generated. Any help would be greatly appreciated!
2 replies
DTDrizzle Team
Created by Ganbatte on 7/17/2024 in #help
How to Reference a Column Type in Drizzle
No description
4 replies