Skip to content

Commit

Permalink
add(databse): prisma + sqlite (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
osiic authored Sep 24, 2023
1 parent eefd8ee commit f09602e
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 1 deletion.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
"author": "cemy",
"license": "ISC",
"dependencies": {
"@prisma/client": "5.3.1",
"discord.js": "^14.13.0",
"dotenv": "^16.3.1"
},
"devDependencies": {
"eslint": "^8.48.0"
"eslint": "^8.48.0",
"prisma": "^5.3.1"
}
}
Binary file added prisma/dev.db
Binary file not shown.
19 changes: 19 additions & 0 deletions prisma/migrations/20230923050137_init/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
-- CreateTable
CREATE TABLE "User" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"email" TEXT NOT NULL,
"name" TEXT
);

-- CreateTable
CREATE TABLE "Post" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"title" TEXT NOT NULL,
"content" TEXT,
"published" BOOLEAN NOT NULL DEFAULT false,
"authorId" INTEGER NOT NULL,
CONSTRAINT "Post_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);

-- CreateIndex
CREATE UNIQUE INDEX "User_email_key" ON "User"("email");
3 changes: 3 additions & 0 deletions prisma/migrations/migration_lock.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Please do not edit this file manually
# It should be added in your version-control system (i.e. Git)
provider = "sqlite"
17 changes: 17 additions & 0 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema

generator client {
provider = "prisma-client-js"
}

datasource db {
provider = "sqlite"
url = env("DATABASE_URL")
}

model UserTicket {
id Int @id @default(autoincrement())
userId BigInt @unique
guildId BigInt @unique
}

0 comments on commit f09602e

Please sign in to comment.