Skip to content

Commit

Permalink
Remove Note and Post models
Browse files Browse the repository at this point in the history
  • Loading branch information
nedgar committed Aug 9, 2023
1 parent afbd70b commit 96600e4
Show file tree
Hide file tree
Showing 8 changed files with 2 additions and 177 deletions.
54 changes: 0 additions & 54 deletions app/models/note.server.ts

This file was deleted.

16 changes: 0 additions & 16 deletions app/models/post.server.ts

This file was deleted.

1 change: 0 additions & 1 deletion app/routes/verification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ export const loader = async ({

const searchParams = new URL(request.url).searchParams;
const threadId = searchParams.get("thid");
console.log("threadId:", threadId);

const holderThreadState = threadId ? getHolderThreadState(threadId) : undefined;
const verifierThreadState = threadId ? getVerifierThreadState(threadId) : undefined;
Expand Down
2 changes: 1 addition & 1 deletion app/session.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const HTTPS_PORTS = [443, 9443];

// const isSecure = process.env.NODE_ENV === "production";
const isSecure = HTTPS_PORTS.includes(Number(process.env.PORT));
console.log("isSecure:", isSecure);
// console.log("isSecure:", isSecure);

export const sessionStorage = createCookieSessionStorage({
cookie: {
Expand Down
11 changes: 0 additions & 11 deletions prisma/migrations/20220713162558_init/migration.sql
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,6 @@ CREATE TABLE "Password" (
CONSTRAINT "Password_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE
);

-- CreateTable
CREATE TABLE "Note" (
"id" TEXT NOT NULL PRIMARY KEY,
"title" TEXT NOT NULL,
"body" TEXT NOT NULL,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
"userId" TEXT NOT NULL,
CONSTRAINT "Note_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE
);

-- CreateIndex
CREATE UNIQUE INDEX "User_email_key" ON "User"("email");

Expand Down
8 changes: 0 additions & 8 deletions prisma/migrations/20230328174656_/migration.sql

This file was deleted.

22 changes: 0 additions & 22 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ model User {
updatedAt DateTime @updatedAt
password Password?
notes Note[]
}

model Password {
Expand All @@ -24,24 +23,3 @@ model Password {
user User @relation(fields: [userId], references: [id], onDelete: Cascade, onUpdate: Cascade)
userId String @unique
}

model Note {
id String @id @default(cuid())
title String
body String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User @relation(fields: [userId], references: [id], onDelete: Cascade, onUpdate: Cascade)
userId String
}

model Post {
slug String @id
title String
markdown String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
65 changes: 1 addition & 64 deletions prisma/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,71 +24,8 @@ async function seed() {
},
});

await prisma.note.create({
data: {
title: "My first note",
body: "Hello, world!",
userId: user.id,
},
});

await prisma.note.create({
data: {
title: "My second note",
body: "Hello, world!",
userId: user.id,
},
});

const posts = [
{
slug: "my-first-post",
title: "My First Post",
markdown: `
# This is my first post
Isn't it great?
`.trim(),
},
{
slug: "90s-mixtape",
title: "A Mixtape I Made Just For You",
markdown: `
# 90s Mixtape
- I wish (Skee-Lo)
- This Is How We Do It (Montell Jordan)
- Everlong (Foo Fighters)
- Ms. Jackson (Outkast)
- Interstate Love Song (Stone Temple Pilots)
- Killing Me Softly With His Song (Fugees, Ms. Lauryn Hill)
- Just a Friend (Biz Markie)
- The Man Who Sold The World (Nirvana)
- Semi-Charmed Life (Third Eye Blind)
- ...Baby One More Time (Britney Spears)
- Better Man (Pearl Jam)
- It's All Coming Back to Me Now (Céline Dion)
- This Kiss (Faith Hill)
- Fly Away (Lenny Kravits)
- Scar Tissue (Red Hot Chili Peppers)
- Santa Monica (Everclear)
- C'mon N' Ride it (Quad City DJ's)
`.trim(),
},
];

for (const post of posts) {
await prisma.post.upsert({
where: { slug: post.slug },
update: post,
create: post,
});
}

const numUsers = await prisma.user.count();
const numPosts = await prisma.post.count();
const numNotes = await prisma.note.count();
console.log(`Database has been seeded with ${numUsers} users, ${numPosts} posts, and ${numNotes} notes. 🌱`);
console.log(`Database has been seeded with ${numUsers} users. 🌱`);
}

seed()
Expand Down

0 comments on commit 96600e4

Please sign in to comment.