-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
github action setup for db deployment (#116)
* github action setup * Migration configuration * Remove migrations from git-ignore * migration commit
- Loading branch information
1 parent
bc05a9f
commit 9a12153
Showing
15 changed files
with
347 additions
and
3 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Deploy MYSQL DB | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- develop | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
- name: Install dependencies | ||
run: npm install | ||
- run: npm run build | ||
- name: Apply all pending migrations to the database | ||
run: npx prisma migrate deploy | ||
env: | ||
DATABASE_URL: ${{ secrets.DATABASE_URL }} |
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 |
---|---|---|
|
@@ -126,6 +126,3 @@ dist | |
|
||
# Local config file | ||
config/local.* | ||
|
||
# Prisma Migrations | ||
prisma/migrations |
114 changes: 114 additions & 0 deletions
114
prisma/archived-migrations/20221209172538_initial/migration.sql
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,114 @@ | ||
-- CreateTable | ||
CREATE TABLE `Users` ( | ||
`id` INTEGER NOT NULL AUTO_INCREMENT, | ||
`email` VARCHAR(191) NOT NULL, | ||
`password` VARCHAR(191) NULL, | ||
`username` VARCHAR(191) NULL, | ||
`firstname` VARCHAR(191) NULL, | ||
`lastname` VARCHAR(191) NULL, | ||
`bio` VARCHAR(191) NULL, | ||
`timezone` VARCHAR(191) NULL, | ||
`googleProfileId` VARCHAR(191) NULL, | ||
`microsoftProfileId` VARCHAR(191) NULL, | ||
`emailVerified` BOOLEAN NOT NULL DEFAULT false, | ||
`isDeleted` BOOLEAN NOT NULL DEFAULT false, | ||
`onboarding` JSON NOT NULL, | ||
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3), | ||
`updatedAt` DATETIME(3) NOT NULL, | ||
|
||
UNIQUE INDEX `Users_email_key`(`email`), | ||
UNIQUE INDEX `Users_username_key`(`username`), | ||
PRIMARY KEY (`id`) | ||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; | ||
|
||
-- CreateTable | ||
CREATE TABLE `Calendar` ( | ||
`id` INTEGER NOT NULL AUTO_INCREMENT, | ||
`name` VARCHAR(191) NOT NULL, | ||
`ownerId` INTEGER NOT NULL, | ||
`isDeleted` BOOLEAN NOT NULL DEFAULT false, | ||
|
||
PRIMARY KEY (`id`) | ||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; | ||
|
||
-- CreateTable | ||
CREATE TABLE `EventType` ( | ||
`id` INTEGER NOT NULL AUTO_INCREMENT, | ||
`name` VARCHAR(191) NOT NULL, | ||
`appGenerated` BOOLEAN NOT NULL, | ||
`ownerId` INTEGER NOT NULL, | ||
`isDeleted` BOOLEAN NOT NULL DEFAULT false, | ||
|
||
PRIMARY KEY (`id`) | ||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; | ||
|
||
-- CreateTable | ||
CREATE TABLE `ParentEvent` ( | ||
`id` INTEGER NOT NULL AUTO_INCREMENT, | ||
`name` VARCHAR(191) NOT NULL, | ||
`description` VARCHAR(191) NULL, | ||
`ownerId` INTEGER NOT NULL, | ||
`eventTypeId` INTEGER NOT NULL, | ||
`isDeleted` BOOLEAN NOT NULL DEFAULT false, | ||
|
||
PRIMARY KEY (`id`) | ||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; | ||
|
||
-- CreateTable | ||
CREATE TABLE `ChildEvent` ( | ||
`id` INTEGER NOT NULL AUTO_INCREMENT, | ||
`name` VARCHAR(191) NOT NULL, | ||
`description` VARCHAR(191) NULL, | ||
`location` VARCHAR(191) NULL, | ||
`startTime` DATETIME(3) NOT NULL, | ||
`endTime` DATETIME(3) NOT NULL, | ||
`parentEventID` INTEGER NOT NULL, | ||
`isDeleted` BOOLEAN NOT NULL DEFAULT false, | ||
`usersId` INTEGER NULL, | ||
`eventTypeId` INTEGER NULL, | ||
|
||
PRIMARY KEY (`id`) | ||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; | ||
|
||
-- CreateTable | ||
CREATE TABLE `RecurringEvent` ( | ||
`id` INTEGER NOT NULL AUTO_INCREMENT, | ||
`eventId` INTEGER NOT NULL, | ||
`recurringFrequency` ENUM('YEARLY', 'MONTHLY', 'WEEKLY', 'DAILY', 'HOURLY') NULL, | ||
`interval` INTEGER NULL, | ||
`count` INTEGER NULL, | ||
`daysOfWeek` VARCHAR(191) NULL, | ||
`weeksOfMonth` VARCHAR(191) NULL, | ||
`daysOfMonth` VARCHAR(191) NULL, | ||
`monthsOfYear` VARCHAR(191) NULL, | ||
|
||
PRIMARY KEY (`id`) | ||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; | ||
|
||
-- CreateTable | ||
CREATE TABLE `Attendees` ( | ||
`id` INTEGER NOT NULL AUTO_INCREMENT, | ||
`eventId` INTEGER NOT NULL, | ||
`attendeeId` INTEGER NOT NULL, | ||
|
||
PRIMARY KEY (`id`) | ||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; | ||
|
||
-- CreateTable | ||
CREATE TABLE `AccessToken` ( | ||
`id` INTEGER NOT NULL AUTO_INCREMENT, | ||
`userId` INTEGER NOT NULL, | ||
`associatedEmail` VARCHAR(191) NOT NULL, | ||
`tokenType` ENUM('BEARER') NOT NULL, | ||
`calendarId` VARCHAR(191) NOT NULL, | ||
`calendarType` ENUM('GOOGLECAL', 'OUTLOOKCAL') NOT NULL, | ||
`scope` VARCHAR(191) NOT NULL, | ||
`expiry` INTEGER NOT NULL, | ||
`accessToken` VARCHAR(191) NOT NULL, | ||
`refreshToken` VARCHAR(191) NOT NULL, | ||
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3), | ||
`updatedAt` DATETIME(3) NOT NULL, | ||
|
||
UNIQUE INDEX `AccessToken_userId_calendarId_key`(`userId`, `calendarId`), | ||
PRIMARY KEY (`id`) | ||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; |
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 @@ | ||
-- AlterTable | ||
ALTER TABLE `Calendar` ADD COLUMN `isPrimary` BOOLEAN NOT NULL DEFAULT false, | ||
ADD COLUMN `isSelected` BOOLEAN NOT NULL DEFAULT false; |
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,10 @@ | ||
/* | ||
Warnings: | ||
- You are about to drop the column `isPrimary` on the `Calendar` table. All the data in the column will be lost. | ||
- You are about to drop the column `isSelected` on the `Calendar` table. All the data in the column will be lost. | ||
*/ | ||
-- AlterTable | ||
ALTER TABLE `Calendar` DROP COLUMN `isPrimary`, | ||
DROP COLUMN `isSelected`; |
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,11 @@ | ||
/* | ||
Warnings: | ||
- You are about to drop the column `usersId` on the `ChildEvent` table. All the data in the column will be lost. | ||
*/ | ||
-- AlterTable | ||
ALTER TABLE `Calendar` ADD COLUMN `isPrimary` BOOLEAN NOT NULL DEFAULT false; | ||
|
||
-- AlterTable | ||
ALTER TABLE `ChildEvent` DROP COLUMN `usersId`; |
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,8 @@ | ||
/* | ||
Warnings: | ||
- Added the required column `calendarId` to the `ParentEvent` table without a default value. This is not possible if the table is not empty. | ||
*/ | ||
-- AlterTable | ||
ALTER TABLE `ParentEvent` ADD COLUMN `calendarId` INTEGER NOT NULL; |
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,16 @@ | ||
/* | ||
Warnings: | ||
- You are about to drop the column `eventTypeId` on the `ChildEvent` table. All the data in the column will be lost. | ||
- Changed the type of `expiry` on the `AccessToken` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. | ||
- Added the required column `calendarId` to the `ChildEvent` table without a default value. This is not possible if the table is not empty. | ||
*/ | ||
-- AlterTable | ||
ALTER TABLE `AccessToken` ADD COLUMN `isDeleted` BOOLEAN NOT NULL DEFAULT false, | ||
DROP COLUMN `expiry`, | ||
ADD COLUMN `expiry` DATETIME(3) NOT NULL; | ||
|
||
-- AlterTable | ||
ALTER TABLE `ChildEvent` DROP COLUMN `eventTypeId`, | ||
ADD COLUMN `calendarId` INTEGER NOT NULL; |
12 changes: 12 additions & 0 deletions
12
prisma/archived-migrations/20230201181349_init/migration.sql
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,12 @@ | ||
/* | ||
Warnings: | ||
- You are about to drop the column `calendarId` on the `ChildEvent` table. All the data in the column will be lost. | ||
- You are about to drop the column `calendarId` on the `ParentEvent` table. All the data in the column will be lost. | ||
*/ | ||
-- AlterTable | ||
ALTER TABLE `ChildEvent` DROP COLUMN `calendarId`; | ||
|
||
-- AlterTable | ||
ALTER TABLE `ParentEvent` DROP COLUMN `calendarId`; |
24 changes: 24 additions & 0 deletions
24
prisma/archived-migrations/20230302145202_v1/migration.sql
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,24 @@ | ||
/* | ||
Warnings: | ||
- You are about to drop the `ChildEvent` table. If the table is not empty, all the data it contains will be lost. | ||
- You are about to drop the `ParentEvent` table. If the table is not empty, all the data it contains will be lost. | ||
*/ | ||
-- DropTable | ||
DROP TABLE `ChildEvent`; | ||
|
||
-- DropTable | ||
DROP TABLE `ParentEvent`; | ||
|
||
-- CreateTable | ||
CREATE TABLE `Event` ( | ||
`id` INTEGER NOT NULL AUTO_INCREMENT, | ||
`name` VARCHAR(191) NOT NULL, | ||
`description` VARCHAR(191) NULL, | ||
`ownerId` INTEGER NOT NULL, | ||
`eventTypeId` INTEGER NOT NULL, | ||
`isDeleted` BOOLEAN NOT NULL DEFAULT false, | ||
|
||
PRIMARY KEY (`id`) | ||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; |
11 changes: 11 additions & 0 deletions
11
prisma/archived-migrations/20230302152353_v2/migration.sql
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,11 @@ | ||
/* | ||
Warnings: | ||
- Added the required column `endTime` to the `Event` table without a default value. This is not possible if the table is not empty. | ||
- Added the required column `startTime` to the `Event` table without a default value. This is not possible if the table is not empty. | ||
*/ | ||
-- AlterTable | ||
ALTER TABLE `Event` ADD COLUMN `endTime` DATETIME(3) NOT NULL, | ||
ADD COLUMN `location` VARCHAR(191) NULL, | ||
ADD COLUMN `startTime` DATETIME(3) NOT NULL; |
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,8 @@ | ||
/* | ||
Warnings: | ||
- Added the required column `calendarId` to the `Event` table without a default value. This is not possible if the table is not empty. | ||
*/ | ||
-- AlterTable | ||
ALTER TABLE `Event` ADD COLUMN `calendarId` INTEGER NOT NULL; |
2 changes: 2 additions & 0 deletions
2
prisma/archived-migrations/20231110171102_is_private_additino/migration.sql
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,2 @@ | ||
-- AlterTable | ||
ALTER TABLE `Event` ADD COLUMN `isPrivate` BOOLEAN NOT NULL DEFAULT true; |
File renamed without changes.
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,106 @@ | ||
-- CreateTable | ||
CREATE TABLE `Users` ( | ||
`id` INTEGER NOT NULL AUTO_INCREMENT, | ||
`email` VARCHAR(191) NOT NULL, | ||
`password` VARCHAR(191) NULL, | ||
`username` VARCHAR(191) NULL, | ||
`firstname` VARCHAR(191) NULL, | ||
`lastname` VARCHAR(191) NULL, | ||
`bio` VARCHAR(191) NULL, | ||
`timezone` VARCHAR(191) NULL, | ||
`googleProfileId` VARCHAR(191) NULL, | ||
`microsoftProfileId` VARCHAR(191) NULL, | ||
`emailVerified` BOOLEAN NOT NULL DEFAULT false, | ||
`isDeleted` BOOLEAN NOT NULL DEFAULT false, | ||
`onboarding` JSON NOT NULL, | ||
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3), | ||
`updatedAt` DATETIME(3) NOT NULL, | ||
|
||
UNIQUE INDEX `Users_email_key`(`email`), | ||
UNIQUE INDEX `Users_username_key`(`username`), | ||
PRIMARY KEY (`id`) | ||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; | ||
|
||
-- CreateTable | ||
CREATE TABLE `Calendar` ( | ||
`id` INTEGER NOT NULL AUTO_INCREMENT, | ||
`name` VARCHAR(191) NOT NULL, | ||
`ownerId` INTEGER NOT NULL, | ||
`isPrimary` BOOLEAN NOT NULL DEFAULT false, | ||
`isDeleted` BOOLEAN NOT NULL DEFAULT false, | ||
|
||
PRIMARY KEY (`id`) | ||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; | ||
|
||
-- CreateTable | ||
CREATE TABLE `EventType` ( | ||
`id` INTEGER NOT NULL AUTO_INCREMENT, | ||
`name` VARCHAR(191) NOT NULL, | ||
`appGenerated` BOOLEAN NOT NULL, | ||
`ownerId` INTEGER NOT NULL, | ||
`isDeleted` BOOLEAN NOT NULL DEFAULT false, | ||
|
||
PRIMARY KEY (`id`) | ||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; | ||
|
||
-- CreateTable | ||
CREATE TABLE `Event` ( | ||
`id` INTEGER NOT NULL AUTO_INCREMENT, | ||
`name` VARCHAR(191) NOT NULL, | ||
`description` VARCHAR(191) NULL, | ||
`location` VARCHAR(191) NULL, | ||
`startTime` DATETIME(3) NOT NULL, | ||
`endTime` DATETIME(3) NOT NULL, | ||
`ownerId` INTEGER NOT NULL, | ||
`eventTypeId` INTEGER NOT NULL, | ||
`calendarId` INTEGER NOT NULL, | ||
`isPrivate` BOOLEAN NOT NULL DEFAULT true, | ||
`isDeleted` BOOLEAN NOT NULL DEFAULT false, | ||
|
||
PRIMARY KEY (`id`) | ||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; | ||
|
||
-- CreateTable | ||
CREATE TABLE `RecurringEvent` ( | ||
`id` INTEGER NOT NULL AUTO_INCREMENT, | ||
`eventId` INTEGER NOT NULL, | ||
`recurringFrequency` ENUM('YEARLY', 'MONTHLY', 'WEEKLY', 'DAILY', 'HOURLY') NULL, | ||
`interval` INTEGER NULL, | ||
`count` INTEGER NULL, | ||
`daysOfWeek` VARCHAR(191) NULL, | ||
`weeksOfMonth` VARCHAR(191) NULL, | ||
`daysOfMonth` VARCHAR(191) NULL, | ||
`monthsOfYear` VARCHAR(191) NULL, | ||
|
||
PRIMARY KEY (`id`) | ||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; | ||
|
||
-- CreateTable | ||
CREATE TABLE `Attendees` ( | ||
`id` INTEGER NOT NULL AUTO_INCREMENT, | ||
`eventId` INTEGER NOT NULL, | ||
`attendeeId` INTEGER NOT NULL, | ||
|
||
PRIMARY KEY (`id`) | ||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; | ||
|
||
-- CreateTable | ||
CREATE TABLE `AccessToken` ( | ||
`id` INTEGER NOT NULL AUTO_INCREMENT, | ||
`userId` INTEGER NOT NULL, | ||
`associatedEmail` VARCHAR(191) NOT NULL, | ||
`tokenType` ENUM('BEARER') NOT NULL, | ||
`calendarId` VARCHAR(191) NOT NULL, | ||
`calendarType` ENUM('GOOGLECAL', 'OUTLOOKCAL') NOT NULL, | ||
`scope` VARCHAR(191) NOT NULL, | ||
`expiry` DATETIME(3) NOT NULL, | ||
`accessToken` VARCHAR(191) NOT NULL, | ||
`refreshToken` VARCHAR(191) NOT NULL, | ||
`isDeleted` BOOLEAN NOT NULL DEFAULT false, | ||
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3), | ||
`updatedAt` DATETIME(3) NOT NULL, | ||
|
||
UNIQUE INDEX `AccessToken_userId_calendarId_key`(`userId`, `calendarId`), | ||
PRIMARY KEY (`id`) | ||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; | ||
|