Skip to content
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

[SWEP-51] Session 테이블 수정 및 마이그레이션 추가 #57

Merged
merged 2 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading