Simon Zeyer 9a26d97209 Init DB and Tests with Components
- add Artikel, Kauf, Kategorie Model
- generate Components
- playing with custom components
- add Tailwindcss
2023-11-05 21:35:01 +00:00

50 lines
1.4 KiB
SQL

/*
Warnings:
- You are about to drop the `artikel` table. If the table is not empty, all the data it contains will be lost.
- You are about to drop the `kauf` table. If the table is not empty, all the data it contains will be lost.
- You are about to drop the `kauf_artikel` table. If the table is not empty, all the data it contains will be lost.
*/
-- DropTable
PRAGMA foreign_keys=off;
DROP TABLE "artikel";
PRAGMA foreign_keys=on;
-- DropTable
PRAGMA foreign_keys=off;
DROP TABLE "kauf";
PRAGMA foreign_keys=on;
-- DropTable
PRAGMA foreign_keys=off;
DROP TABLE "kauf_artikel";
PRAGMA foreign_keys=on;
-- CreateTable
CREATE TABLE "Kauf_Artikel" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"kauf_id" INTEGER NOT NULL,
"artikel_id" INTEGER NOT NULL,
"anzahl" INTEGER NOT NULL,
CONSTRAINT "Kauf_Artikel_kauf_id_fkey" FOREIGN KEY ("kauf_id") REFERENCES "Kauf" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
CONSTRAINT "Kauf_Artikel_artikel_id_fkey" FOREIGN KEY ("artikel_id") REFERENCES "Artikel" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);
-- CreateTable
CREATE TABLE "Artikel" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"name" TEXT NOT NULL,
"preis" REAL
);
-- CreateTable
CREATE TABLE "Kauf" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"timestamp" INTEGER NOT NULL,
"preis_ges" REAL
);
-- CreateIndex
CREATE UNIQUE INDEX "Artikel_name_key" ON "Artikel"("name");