Skip to content

Commit

Permalink
feat: use shadow db
Browse files Browse the repository at this point in the history
  • Loading branch information
raipen committed Apr 13, 2024
1 parent 279d1f1 commit f34525e
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ chmod +x ./wait-for-it.sh
echo "start node server"
if [ "$NODE_ENV" = "production" ]; then
echo "production mode"
npm run deploy:withoutShadow
npm run deploy
else
npm run prisma:generate
npm run prisma:migrate:dev
Expand Down
56 changes: 56 additions & 0 deletions prisma/migrations/20240413133431_init/migration.sql
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;
3 changes: 3 additions & 0 deletions prisma/migrations/migration_lock.toml
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"

0 comments on commit f34525e

Please sign in to comment.