api: add prisma configs and baseline schema
Pedro Lucas Porcellis porcellis@eletrotupi.com · 7 months ago
836d3533005b68bed399214d7af47d18ccfe90fe Browse filesParents
0be1c3dChanged files
4
Additions
+48
Deletions
-1
api/.gitignore
1 1
node_modules
2 2
.env
3 -
src/generated_prisma
3 +
src/generated/prisma
4 4
orbit.db
/dev/null → api/prisma.config.ts
1 +
import "dotenv/config";
2 +
import { defineConfig } from "prisma/config";
3 +
4 +
export default defineConfig({
5 +
schema: "prisma/schema.prisma",
6 +
migrations: {
7 +
path: "prisma/migrations",
8 +
},
9 +
datasource: {
10 +
url: process.env["DATABASE_URL"],
11 +
},
12 +
});
/dev/null → api/prisma/migrations/0_init/migration.sql
1 +
-- CreateTable
2 +
CREATE TABLE "users" (
3 +
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
4 +
"first_name" TEXT NOT NULL,
5 +
"last_name" TEXT,
6 +
"email" TEXT NOT NULL,
7 +
"encrypted_password" TEXT NOT NULL,
8 +
"created_at" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
9 +
"updated_at" DATETIME NOT NULL
10 +
);
11 +
12 +
-- CreateIndex
13 +
CREATE UNIQUE INDEX "users_email_key" ON "users"("email");
14 +
/dev/null → api/prisma/schema.prisma
1 +
generator client {
2 +
provider = "prisma-client"
3 +
output = "../src/generated/prisma"
4 +
}
5 +
6 +
datasource db {
7 +
provider = "sqlite"
8 +
}
9 +
10 +
model User {
11 +
id Int @id @default(autoincrement())
12 +
firstName String @map("first_name")
13 +
lastName String? @map("last_name")
14 +
email String @unique
15 +
encryptedPassword String @map("encrypted_password")
16 +
createdAt DateTime @default(now()) @map("created_at")
17 +
updatedAt DateTime @updatedAt @map("updated_at")
18 +
19 +
20 +
@@map("users")
21 +
}