mirror of https://github.com/ghostfolio/ghostfolio
Thomas Kaul
3 years ago
committed by
GitHub
3 changed files with 39 additions and 1 deletions
@ -0,0 +1,28 @@ |
|||||
|
-- CreateTable |
||||
|
CREATE TABLE "Tag" ( |
||||
|
"id" TEXT NOT NULL, |
||||
|
"name" TEXT NOT NULL, |
||||
|
|
||||
|
CONSTRAINT "Tag_pkey" PRIMARY KEY ("id") |
||||
|
); |
||||
|
|
||||
|
-- CreateTable |
||||
|
CREATE TABLE "_OrderToTag" ( |
||||
|
"A" TEXT NOT NULL, |
||||
|
"B" TEXT NOT NULL |
||||
|
); |
||||
|
|
||||
|
-- CreateIndex |
||||
|
CREATE UNIQUE INDEX "Tag_name_key" ON "Tag"("name"); |
||||
|
|
||||
|
-- CreateIndex |
||||
|
CREATE UNIQUE INDEX "_OrderToTag_AB_unique" ON "_OrderToTag"("A", "B"); |
||||
|
|
||||
|
-- CreateIndex |
||||
|
CREATE INDEX "_OrderToTag_B_index" ON "_OrderToTag"("B"); |
||||
|
|
||||
|
-- AddForeignKey |
||||
|
ALTER TABLE "_OrderToTag" ADD FOREIGN KEY ("A") REFERENCES "Order"("id") ON DELETE CASCADE ON UPDATE CASCADE; |
||||
|
|
||||
|
-- AddForeignKey |
||||
|
ALTER TABLE "_OrderToTag" ADD FOREIGN KEY ("B") REFERENCES "Tag"("id") ON DELETE CASCADE ON UPDATE CASCADE; |
Loading…
Reference in new issue