-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
60 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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,56 @@ | ||
-- CreateTable | ||
CREATE TABLE `User` ( | ||
`uuid` VARCHAR(191) NOT NULL, | ||
`name` VARCHAR(191) NOT NULL, | ||
`socialType` ENUM('GOOGLE', 'KAKAO', 'NAVER') NOT NULL DEFAULT 'KAKAO', | ||
`socialId` VARCHAR(191) NOT NULL, | ||
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3), | ||
`updatedAt` DATETIME(3) NOT NULL, | ||
|
||
UNIQUE INDEX `User_uuid_key`(`uuid`), | ||
UNIQUE INDEX `User_socialType_socialId_key`(`socialType`, `socialId`), | ||
PRIMARY KEY (`uuid`) | ||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; | ||
|
||
-- CreateTable | ||
CREATE TABLE `Wordbook` ( | ||
`uuid` VARCHAR(191) NOT NULL, | ||
`title` VARCHAR(191) NOT NULL, | ||
`userId` VARCHAR(191) NOT NULL, | ||
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3), | ||
`updatedAt` DATETIME(3) NOT NULL, | ||
`isHidden` BOOLEAN NOT NULL DEFAULT false, | ||
`deletedAt` DATETIME(3) NULL, | ||
|
||
UNIQUE INDEX `Wordbook_uuid_key`(`uuid`), | ||
PRIMARY KEY (`uuid`) | ||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; | ||
|
||
-- CreateTable | ||
CREATE TABLE `Voca` ( | ||
`id` INTEGER NOT NULL AUTO_INCREMENT, | ||
`word` VARCHAR(191) NOT NULL, | ||
`checkCount` INTEGER NOT NULL DEFAULT 0, | ||
`order` INTEGER NOT NULL DEFAULT 0, | ||
`wordbookId` VARCHAR(191) NOT NULL, | ||
|
||
PRIMARY KEY (`id`) | ||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; | ||
|
||
-- CreateTable | ||
CREATE TABLE `Meaning` ( | ||
`id` INTEGER NOT NULL AUTO_INCREMENT, | ||
`meaning` VARCHAR(191) NOT NULL, | ||
`vocaId` INTEGER NOT NULL, | ||
|
||
PRIMARY KEY (`id`) | ||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE `Wordbook` ADD CONSTRAINT `Wordbook_userId_fkey` FOREIGN KEY (`userId`) REFERENCES `User`(`uuid`) ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE `Voca` ADD CONSTRAINT `Voca_wordbookId_fkey` FOREIGN KEY (`wordbookId`) REFERENCES `Wordbook`(`uuid`) ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE `Meaning` ADD CONSTRAINT `Meaning_vocaId_fkey` FOREIGN KEY (`vocaId`) REFERENCES `Voca`(`id`) ON DELETE CASCADE ON UPDATE CASCADE; |
This file contains 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,3 @@ | ||
# Please do not edit this file manually | ||
# It should be added in your version-control system (i.e. Git) | ||
provider = "mysql" |