Peter Kellner
07/06/2021, 5:22 PMCREATE TABLE "Category" (
id SERIAL PRIMARY KEY
);
CREATE TABLE "Post" (
id SERIAL PRIMARY KEY
);
-- Relation table + indexes -------------------------------------------------------
CREATE TABLE "_CategoryToPost" (
"A" integer NOT NULL REFERENCES "Category"(id),
"B" integer NOT NULL REFERENCES "Post"(id)
);
CREATE UNIQUE INDEX "_CategoryToPost_AB_unique" ON "_CategoryToPost"("A" int4_ops,"B" int4_ops);
CREATE INDEX "_CategoryToPost_B_index" ON "_CategoryToPost"("B" int4_ops);janpio
janpio
Peter Kellner
07/06/2021, 5:26 PMPeter Kellner
07/06/2021, 5:32 PMPeter Kellner
07/06/2021, 5:34 PMjanpio
janpio
janpio
janpio
Peter Kellner
07/06/2021, 5:38 PMjanpio
janpio
janpio
janpio
janpio
Peter Kellner
07/06/2021, 7:20 PMALTER TABLE _NoteToTag ADD primary key (A,B) and that seemed to work at least with no error and my app still worked. It does seem like it's something you should at least create an option for. I'm guessing the only reason it's not an error in MySql is that a long long time ago before everyone believed in primary keys, a lot of apps were built that still exist. I have a lot of road rash from having to fix those apps.Peter Kellner
07/06/2021, 7:21 PMjanpio
janpio
janpio
janpio
Peter Kellner
07/06/2021, 7:25 PMPeter Kellner
07/06/2021, 7:27 PMPeter Kellner
07/06/2021, 7:29 PMjanpio
migrate dev --create-only, then modify the file and apply it with another migrate dev or migrate deploy.
The problem with that is that any future migration you create also needs to be done via --create-only so you can remove the statement that would undo your manual modification again 😕janpio
Peter Kellner
07/06/2021, 7:47 PMprisma introspect? Would that somehow bring the primary key back int the initial migration file, then I can move forward with the normal migration process as I make changes?janpio
janpio
janpio
Peter Kellner
07/06/2021, 7:56 PMPeter Kellner
07/06/2021, 7:58 PMjanpio
janpio
janpio
janpio
janpio
Peter Kellner
07/06/2021, 8:01 PMjanpio
janpio
Peter Kellner
07/06/2021, 8:04 PMPeter Kellner
07/06/2021, 8:05 PMjanpio
(...) 😛 But yep, always 👍janpio
janpio
janpio
Peter Kellner
07/06/2021, 8:13 PMjanpio
janpio