Skip to content

Commit

Permalink
Merge pull request #56 from GodUser1005/develop
Browse files Browse the repository at this point in the history
fix: Session 테이블 수정 및 마이그레이션 파일 추가
  • Loading branch information
GodUser1005 authored Jan 21, 2025
2 parents 38ae387 + 0e37c7f commit a6b9392
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
Warnings:
- You are about to drop the column `user_id` on the `session` table. All the data in the column will be lost.
- A unique constraint covering the columns `[sid]` on the table `session` will be added. If there are existing duplicate values, this will fail.
- Made the column `expires_at` on table `session` required. This step will fail if there are existing NULL values in that column.
*/
-- DropForeignKey
ALTER TABLE `session` DROP FOREIGN KEY `session_user_id_fkey`;

-- DropIndex
DROP INDEX `session_user_id_fkey` ON `session`;

-- AlterTable
ALTER TABLE `session` DROP COLUMN `user_id`,
MODIFY `expires_at` TIMESTAMP(3) NOT NULL;

-- CreateIndex
CREATE UNIQUE INDEX `session_sid_key` ON `session`(`sid`);
7 changes: 2 additions & 5 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ model User {
updatedAt DateTime? @db.Timestamp(6) @updatedAt @map("updated_at")
status Int @db.TinyInt @default(1)
sessions Session[]
socialAccounts SocialAccount[]
notification Notification?
images Image[]
Expand Down Expand Up @@ -62,12 +61,10 @@ model Notification {

model Session {
id String @id @db.VarChar(255)
sid String @db.VarChar(255)
sid String @unique @db.VarChar(255)
data String @db.VarChar(512)
expiresAt DateTime? @db.Timestamp(3) @map("expires_at")
expiresAt DateTime @db.Timestamp(3) @map("expires_at")
userId BigInt @map("user_id")
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@map("session")
}

Expand Down

0 comments on commit a6b9392

Please sign in to comment.