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'
0 Replies