/* Warnings: - You are about to drop the `deed_has_document_types` table. If the table is not empty, all the data it contains will be lost. - You are about to drop the `deed_type_has_document_types` table. If the table is not empty, all the data it contains will be lost. - You are about to drop the `office_folder_has_customers` table. If the table is not empty, all the data it contains will be lost. - You are about to drop the `office_folder_has_stakeholder` table. If the table is not empty, all the data it contains will be lost. - You are about to drop the `user_has_notifications` table. If the table is not empty, all the data it contains will be lost. */ -- DropForeignKey ALTER TABLE "deed_has_document_types" DROP CONSTRAINT "deed_has_document_types_deed_uid_fkey"; -- DropForeignKey ALTER TABLE "deed_has_document_types" DROP CONSTRAINT "deed_has_document_types_document_type_uid_fkey"; -- DropForeignKey ALTER TABLE "deed_type_has_document_types" DROP CONSTRAINT "deed_type_has_document_types_deed_type_uid_fkey"; -- DropForeignKey ALTER TABLE "deed_type_has_document_types" DROP CONSTRAINT "deed_type_has_document_types_document_type_uid_fkey"; -- DropForeignKey ALTER TABLE "office_folder_has_customers" DROP CONSTRAINT "office_folder_has_customers_customer_uid_fkey"; -- DropForeignKey ALTER TABLE "office_folder_has_customers" DROP CONSTRAINT "office_folder_has_customers_office_folder_uid_fkey"; -- DropForeignKey ALTER TABLE "office_folder_has_stakeholder" DROP CONSTRAINT "office_folder_has_stakeholder_office_folder_uid_fkey"; -- DropForeignKey ALTER TABLE "office_folder_has_stakeholder" DROP CONSTRAINT "office_folder_has_stakeholder_user_stakeholder_uid_fkey"; -- DropForeignKey ALTER TABLE "user_has_notifications" DROP CONSTRAINT "user_has_notifications_notification_uid_fkey"; -- DropForeignKey ALTER TABLE "user_has_notifications" DROP CONSTRAINT "user_has_notifications_user_uid_fkey"; -- DropTable DROP TABLE "deed_has_document_types"; -- DropTable DROP TABLE "deed_type_has_document_types"; -- DropTable DROP TABLE "office_folder_has_customers"; -- DropTable DROP TABLE "office_folder_has_stakeholder"; -- DropTable DROP TABLE "user_has_notifications"; -- CreateTable CREATE TABLE "_OfficeFolderHasCustomers" ( "A" TEXT NOT NULL, "B" TEXT NOT NULL ); -- CreateTable CREATE TABLE "_UserHasNotifications" ( "A" TEXT NOT NULL, "B" TEXT NOT NULL ); -- CreateTable CREATE TABLE "_OfficeFolderHasStakeholders" ( "A" TEXT NOT NULL, "B" TEXT NOT NULL ); -- CreateTable CREATE TABLE "_DeedHasDocumentTypes" ( "A" TEXT NOT NULL, "B" TEXT NOT NULL ); -- CreateTable CREATE TABLE "_DeedTypeHasDocumentTypes" ( "A" TEXT NOT NULL, "B" TEXT NOT NULL ); -- CreateIndex CREATE UNIQUE INDEX "_OfficeFolderHasCustomers_AB_unique" ON "_OfficeFolderHasCustomers"("A", "B"); -- CreateIndex CREATE INDEX "_OfficeFolderHasCustomers_B_index" ON "_OfficeFolderHasCustomers"("B"); -- CreateIndex CREATE UNIQUE INDEX "_UserHasNotifications_AB_unique" ON "_UserHasNotifications"("A", "B"); -- CreateIndex CREATE INDEX "_UserHasNotifications_B_index" ON "_UserHasNotifications"("B"); -- CreateIndex CREATE UNIQUE INDEX "_OfficeFolderHasStakeholders_AB_unique" ON "_OfficeFolderHasStakeholders"("A", "B"); -- CreateIndex CREATE INDEX "_OfficeFolderHasStakeholders_B_index" ON "_OfficeFolderHasStakeholders"("B"); -- CreateIndex CREATE UNIQUE INDEX "_DeedHasDocumentTypes_AB_unique" ON "_DeedHasDocumentTypes"("A", "B"); -- CreateIndex CREATE INDEX "_DeedHasDocumentTypes_B_index" ON "_DeedHasDocumentTypes"("B"); -- CreateIndex CREATE UNIQUE INDEX "_DeedTypeHasDocumentTypes_AB_unique" ON "_DeedTypeHasDocumentTypes"("A", "B"); -- CreateIndex CREATE INDEX "_DeedTypeHasDocumentTypes_B_index" ON "_DeedTypeHasDocumentTypes"("B"); -- AddForeignKey ALTER TABLE "_OfficeFolderHasCustomers" ADD CONSTRAINT "_OfficeFolderHasCustomers_A_fkey" FOREIGN KEY ("A") REFERENCES "customers"("uid") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "_OfficeFolderHasCustomers" ADD CONSTRAINT "_OfficeFolderHasCustomers_B_fkey" FOREIGN KEY ("B") REFERENCES "office_folders"("uid") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "_UserHasNotifications" ADD CONSTRAINT "_UserHasNotifications_A_fkey" FOREIGN KEY ("A") REFERENCES "notifications"("uid") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "_UserHasNotifications" ADD CONSTRAINT "_UserHasNotifications_B_fkey" FOREIGN KEY ("B") REFERENCES "users"("uid") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "_OfficeFolderHasStakeholders" ADD CONSTRAINT "_OfficeFolderHasStakeholders_A_fkey" FOREIGN KEY ("A") REFERENCES "office_folders"("uid") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "_OfficeFolderHasStakeholders" ADD CONSTRAINT "_OfficeFolderHasStakeholders_B_fkey" FOREIGN KEY ("B") REFERENCES "users"("uid") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "_DeedHasDocumentTypes" ADD CONSTRAINT "_DeedHasDocumentTypes_A_fkey" FOREIGN KEY ("A") REFERENCES "deed"("uid") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "_DeedHasDocumentTypes" ADD CONSTRAINT "_DeedHasDocumentTypes_B_fkey" FOREIGN KEY ("B") REFERENCES "document_types"("uid") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "_DeedTypeHasDocumentTypes" ADD CONSTRAINT "_DeedTypeHasDocumentTypes_A_fkey" FOREIGN KEY ("A") REFERENCES "deed_types"("uid") ON DELETE CASCADE ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "_DeedTypeHasDocumentTypes" ADD CONSTRAINT "_DeedTypeHasDocumentTypes_B_fkey" FOREIGN KEY ("B") REFERENCES "document_types"("uid") ON DELETE CASCADE ON UPDATE CASCADE;