-
Notifications
You must be signed in to change notification settings - Fork 0
Add Subpost model and one-to-many relation to Post in Prisma schema #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
f7ab5be
feat: Add Subpost model and update Post model to include subposts
ginzahatemi 58d7c87
refactor: Simplify Post and Subpost models by removing redundant fiel…
ginzahatemi 162cb0d
feat: Update Post and Subpost models by dropping redundant columns an…
ginzahatemi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
prisma/migrations/20250915081725_add_subpost_model/migration.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
-- CreateTable | ||
CREATE TABLE "public"."Subpost" ( | ||
"id" TEXT NOT NULL, | ||
"content" TEXT NOT NULL, | ||
"postId" TEXT NOT NULL, | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMP(3) NOT NULL, | ||
|
||
CONSTRAINT "Subpost_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "public"."Subpost" ADD CONSTRAINT "Subpost_postId_fkey" FOREIGN KEY ("postId") REFERENCES "public"."Post"("id") ON DELETE RESTRICT ON UPDATE CASCADE; |
39 changes: 39 additions & 0 deletions
39
prisma/migrations/20250915090632_update_post_subpost_model/migration.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
Warnings: | ||
|
||
- You are about to drop the column `categories` on the `Post` table. All the data in the column will be lost. | ||
- You are about to drop the column `content` on the `Post` table. All the data in the column will be lost. | ||
- You are about to drop the column `createdAt` on the `Post` table. All the data in the column will be lost. | ||
- You are about to drop the column `sentiment` on the `Post` table. All the data in the column will be lost. | ||
- You are about to drop the column `source` on the `Post` table. All the data in the column will be lost. | ||
- You are about to drop the column `subcategories` on the `Post` table. All the data in the column will be lost. | ||
- You are about to drop the column `updatedAt` on the `Post` table. All the data in the column will be lost. | ||
- Added the required column `sentiment` to the `Subpost` table without a default value. This is not possible if the table is not empty. | ||
- Added the required column `source` to the `Subpost` table without a default value. This is not possible if the table is not empty. | ||
|
||
*/ | ||
-- DropIndex | ||
DROP INDEX "public"."Post_categories_idx"; | ||
|
||
-- DropIndex | ||
DROP INDEX "public"."Post_subcategories_idx"; | ||
|
||
-- AlterTable | ||
ALTER TABLE "public"."Post" DROP COLUMN "categories", | ||
DROP COLUMN "content", | ||
DROP COLUMN "createdAt", | ||
DROP COLUMN "sentiment", | ||
DROP COLUMN "source", | ||
DROP COLUMN "subcategories", | ||
DROP COLUMN "updatedAt", | ||
ADD COLUMN "bearishSummary" TEXT, | ||
ADD COLUMN "bullishSummary" TEXT, | ||
ADD COLUMN "neutralSummary" TEXT, | ||
ADD COLUMN "totalSubposts" INTEGER NOT NULL DEFAULT 0; | ||
|
||
-- AlterTable | ||
ALTER TABLE "public"."Subpost" ADD COLUMN "categories" TEXT[] DEFAULT ARRAY[]::TEXT[], | ||
ADD COLUMN "link" TEXT, | ||
ADD COLUMN "sentiment" "public"."Sentiment" NOT NULL, | ||
ADD COLUMN "source" "public"."Source" NOT NULL, | ||
ADD COLUMN "subcategories" TEXT[] DEFAULT ARRAY[]::TEXT[]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.