calcom/prisma/migrations/20211207010154_add_destination_calendar/migration.sql
Alex Johansson 850497ea80
add select primary calendar (#1133)
* add primary

* fix

* refactor eventmanager to take `CalendarDestination`

* `DestinationCalendar`

* fix

* wip

* wip

* Minor fixes (#1156)

* Followup for #1242

* Updates schema

* Renames fields to destinationCalendar

* Migration fixes

* Updates user destination calendar

* Abstracts convertDate to BaseCalendarApiAdapter

* Type fixes

* Uses abstracted convertDate method

* Abstracts getDuration and getAttendees

* Fixes circular dependecy issue

* Adds notEmpty util

* Reverts empty location string

* Fixes property name

* Removes deprecated code

* WIP

* AppleCal is basically CalDav

* Fixes missing destinationCalendar

* Type fixes

* Select primary calendar on Office and gCal

* Adds pretty basic instructions for destination calendar

* Cleanup

* Type fix

* Test fixes

* Updates test snapshot

* Local test fixes

* Type fixes

Co-authored-by: Peer Richelsen <peeroke@gmail.com>
Co-authored-by: Omar López <zomars@me.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-12-09 15:51:37 +00:00

29 lines
1 KiB
SQL

-- CreateTable
CREATE TABLE "DestinationCalendar" (
"id" SERIAL NOT NULL,
"integration" TEXT NOT NULL,
"externalId" TEXT NOT NULL,
"userId" INTEGER,
"bookingId" INTEGER,
"eventTypeId" INTEGER,
PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "DestinationCalendar.userId_unique" ON "DestinationCalendar"("userId");
-- CreateIndex
CREATE UNIQUE INDEX "DestinationCalendar.bookingId_unique" ON "DestinationCalendar"("bookingId");
-- CreateIndex
CREATE UNIQUE INDEX "DestinationCalendar.eventTypeId_unique" ON "DestinationCalendar"("eventTypeId");
-- AddForeignKey
ALTER TABLE "DestinationCalendar" ADD FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "DestinationCalendar" ADD FOREIGN KEY ("bookingId") REFERENCES "Booking"("id") ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "DestinationCalendar" ADD FOREIGN KEY ("eventTypeId") REFERENCES "EventType"("id") ON DELETE SET NULL ON UPDATE CASCADE;