Skip to content

Commit

Permalink
Merge pull request #125 from boostcampwm-2024/feature/deploy
Browse files Browse the repository at this point in the history
ncloud 서버에서의 데이터베이스 마이그레이션을 위한 prisma/migrations 추가
  • Loading branch information
SeoGeonhyuk authored Nov 20, 2024
2 parents aaf2567 + 139f6a0 commit a7cc1d5
Show file tree
Hide file tree
Showing 4 changed files with 15,728 additions and 11,707 deletions.
5 changes: 1 addition & 4 deletions apps/server/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,4 @@ pids
*.pid.lock

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Prisma
prisma/migrations
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
111 changes: 111 additions & 0 deletions apps/server/prisma/migrations/20241120062624_/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
-- CreateTable
CREATE TABLE `private_architecture_version` (
`id` INTEGER NOT NULL AUTO_INCREMENT,
`private_architecture_id` INTEGER NOT NULL,
`title` CHAR(50) NOT NULL,
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
`architecture` JSON NOT NULL,

PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

-- CreateTable
CREATE TABLE `private_architecture` (
`id` INTEGER NOT NULL AUTO_INCREMENT,
`title` CHAR(50) NOT NULL,
`author_id` INTEGER NOT NULL,
`architecture` JSON NOT NULL,
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
`updated_at` TIMESTAMP(0) NULL,

PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

-- CreateTable
CREATE TABLE `public_architecture_import` (
`id` INTEGER NOT NULL AUTO_INCREMENT,
`public_architecture_id` INTEGER NOT NULL,
`user_id` INTEGER NOT NULL,
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),

UNIQUE INDEX `public_architecture_import_public_architecture_id_user_id_key`(`public_architecture_id`, `user_id`),
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

-- CreateTable
CREATE TABLE `public_architecture_star` (
`id` INTEGER NOT NULL AUTO_INCREMENT,
`public_architecture_id` INTEGER NOT NULL,
`user_id` INTEGER NOT NULL,
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),

UNIQUE INDEX `public_architecture_star_public_architecture_id_user_id_key`(`public_architecture_id`, `user_id`),
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

-- CreateTable
CREATE TABLE `public_architecture_tag` (
`id` INTEGER NOT NULL AUTO_INCREMENT,
`public_architecture_id` INTEGER NOT NULL,
`tag_id` INTEGER NOT NULL,

UNIQUE INDEX `public_architecture_tag_public_architecture_id_tag_id_key`(`public_architecture_id`, `tag_id`),
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

-- CreateTable
CREATE TABLE `public_architecture` (
`id` INTEGER NOT NULL AUTO_INCREMENT,
`title` CHAR(50) NOT NULL,
`author_id` INTEGER NOT NULL,
`architecture` JSON NOT NULL,
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
`cost` DOUBLE NOT NULL DEFAULT 0,

PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

-- CreateTable
CREATE TABLE `tag` (
`id` INTEGER NOT NULL AUTO_INCREMENT,
`name` VARCHAR(15) NOT NULL,
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),

PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

-- CreateTable
CREATE TABLE `user` (
`id` INTEGER NOT NULL AUTO_INCREMENT,
`name` VARCHAR(30) NOT NULL,
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),

PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

-- AddForeignKey
ALTER TABLE `private_architecture_version` ADD CONSTRAINT `private_architecture_version_private_architecture_id_fkey` FOREIGN KEY (`private_architecture_id`) REFERENCES `private_architecture`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `private_architecture` ADD CONSTRAINT `private_architecture_author_id_fkey` FOREIGN KEY (`author_id`) REFERENCES `user`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `public_architecture_import` ADD CONSTRAINT `public_architecture_import_public_architecture_id_fkey` FOREIGN KEY (`public_architecture_id`) REFERENCES `public_architecture`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `public_architecture_import` ADD CONSTRAINT `public_architecture_import_user_id_fkey` FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `public_architecture_star` ADD CONSTRAINT `public_architecture_star_public_architecture_id_fkey` FOREIGN KEY (`public_architecture_id`) REFERENCES `public_architecture`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `public_architecture_star` ADD CONSTRAINT `public_architecture_star_user_id_fkey` FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `public_architecture_tag` ADD CONSTRAINT `public_architecture_tag_public_architecture_id_fkey` FOREIGN KEY (`public_architecture_id`) REFERENCES `public_architecture`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `public_architecture_tag` ADD CONSTRAINT `public_architecture_tag_tag_id_fkey` FOREIGN KEY (`tag_id`) REFERENCES `tag`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `public_architecture` ADD CONSTRAINT `public_architecture_author_id_fkey` FOREIGN KEY (`author_id`) REFERENCES `user`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
3 changes: 3 additions & 0 deletions apps/server/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"
Loading

0 comments on commit a7cc1d5

Please sign in to comment.