/*
  Warnings:

  - Added the required column `mail` to the `mails` table without a default value. This is not possible if the table is not empty.

*/
-- DropForeignKey
ALTER TABLE `accounts` DROP FOREIGN KEY `accounts_user_id_fkey`;

-- DropForeignKey
ALTER TABLE `admins` DROP FOREIGN KEY `admins_role_id_fkey`;

-- DropForeignKey
ALTER TABLE `admins` DROP FOREIGN KEY `admins_user_id_fkey`;

-- DropForeignKey
ALTER TABLE `care_giver_queries` DROP FOREIGN KEY `care_giver_queries_care_giver_id_fkey`;

-- DropForeignKey
ALTER TABLE `care_giver_queries` DROP FOREIGN KEY `care_giver_queries_user_id_fkey`;

-- DropForeignKey
ALTER TABLE `cart_items` DROP FOREIGN KEY `cart_items_product_id_fkey`;

-- DropForeignKey
ALTER TABLE `cart_items` DROP FOREIGN KEY `cart_items_shopping_cart_id_fkey`;

-- DropForeignKey
ALTER TABLE `classified_images` DROP FOREIGN KEY `classified_images_classified_id_fkey`;

-- DropForeignKey
ALTER TABLE `classified_payments` DROP FOREIGN KEY `classified_payments_classified_id_fkey`;

-- DropForeignKey
ALTER TABLE `classified_queries` DROP FOREIGN KEY `classified_queries_classified_id_fkey`;

-- DropForeignKey
ALTER TABLE `classified_queries` DROP FOREIGN KEY `classified_queries_created_by_id_fkey`;

-- DropForeignKey
ALTER TABLE `classifieds` DROP FOREIGN KEY `classifieds_created_by_id_fkey`;

-- DropForeignKey
ALTER TABLE `contacts` DROP FOREIGN KEY `contacts_type_id_fkey`;

-- DropForeignKey
ALTER TABLE `content_images` DROP FOREIGN KEY `content_images_content_id_fkey`;

-- DropForeignKey
ALTER TABLE `content_videos` DROP FOREIGN KEY `content_videos_content_id_fkey`;

-- DropForeignKey
ALTER TABLE `contents` DROP FOREIGN KEY `contents_category_id_fkey`;

-- DropForeignKey
ALTER TABLE `ebook_comments` DROP FOREIGN KEY `ebook_comments_ebook_id_fkey`;

-- DropForeignKey
ALTER TABLE `ebook_comments` DROP FOREIGN KEY `ebook_comments_user_id_fkey`;

-- DropForeignKey
ALTER TABLE `forum_comments` DROP FOREIGN KEY `forum_comments_created_by_id_fkey`;

-- DropForeignKey
ALTER TABLE `forum_comments` DROP FOREIGN KEY `forum_comments_forum_id_fkey`;

-- DropForeignKey
ALTER TABLE `forum_suggestions` DROP FOREIGN KEY `forum_suggestions_created_by_id_fkey`;

-- DropForeignKey
ALTER TABLE `learning_class_attributes` DROP FOREIGN KEY `learning_class_attributes_class_id_fkey`;

-- DropForeignKey
ALTER TABLE `learning_class_images` DROP FOREIGN KEY `learning_class_images_class_id_fkey`;

-- DropForeignKey
ALTER TABLE `learning_class_reviews` DROP FOREIGN KEY `learning_class_reviews_class_id_fkey`;

-- DropForeignKey
ALTER TABLE `learning_class_reviews` DROP FOREIGN KEY `learning_class_reviews_user_id_fkey`;

-- DropForeignKey
ALTER TABLE `learning_class_videos` DROP FOREIGN KEY `learning_class_videos_class_id_fkey`;

-- DropForeignKey
ALTER TABLE `learning_classes` DROP FOREIGN KEY `learning_classes_category_id_fkey`;

-- DropForeignKey
ALTER TABLE `learning_classes` DROP FOREIGN KEY `learning_classes_created_by_id_fkey`;

-- DropForeignKey
ALTER TABLE `merchant_payments` DROP FOREIGN KEY `merchant_payments_merchant_id_fkey`;

-- DropForeignKey
ALTER TABLE `news_images` DROP FOREIGN KEY `news_images_news_update_id_fkey`;

-- DropForeignKey
ALTER TABLE `news_updates` DROP FOREIGN KEY `news_updates_category_id_fkey`;

-- DropForeignKey
ALTER TABLE `news_updates` DROP FOREIGN KEY `news_updates_created_by_id_fkey`;

-- DropForeignKey
ALTER TABLE `order_items` DROP FOREIGN KEY `order_items_order_id_fkey`;

-- DropForeignKey
ALTER TABLE `order_items` DROP FOREIGN KEY `order_items_product_id_fkey`;

-- DropForeignKey
ALTER TABLE `order_payments` DROP FOREIGN KEY `order_payments_order_id_fkey`;

-- DropForeignKey
ALTER TABLE `order_returns` DROP FOREIGN KEY `order_returns_order_id_fkey`;

-- DropForeignKey
ALTER TABLE `order_shippings` DROP FOREIGN KEY `order_shippings_order_id_fkey`;

-- DropForeignKey
ALTER TABLE `post_comments` DROP FOREIGN KEY `post_comments_created_by_id_fkey`;

-- DropForeignKey
ALTER TABLE `post_comments` DROP FOREIGN KEY `post_comments_post_id_fkey`;

-- DropForeignKey
ALTER TABLE `post_images` DROP FOREIGN KEY `post_images_post_id_fkey`;

-- DropForeignKey
ALTER TABLE `post_likes` DROP FOREIGN KEY `post_likes_post_id_fkey`;

-- DropForeignKey
ALTER TABLE `post_likes` DROP FOREIGN KEY `post_likes_user_id_fkey`;

-- DropForeignKey
ALTER TABLE `post_videos` DROP FOREIGN KEY `post_videos_post_id_fkey`;

-- DropForeignKey
ALTER TABLE `posts` DROP FOREIGN KEY `posts_created_by_id_fkey`;

-- DropForeignKey
ALTER TABLE `product_attributes` DROP FOREIGN KEY `product_attributes_product_id_fkey`;

-- DropForeignKey
ALTER TABLE `product_discounts` DROP FOREIGN KEY `product_discounts_product_id_fkey`;

-- DropForeignKey
ALTER TABLE `product_images` DROP FOREIGN KEY `product_images_product_id_fkey`;

-- DropForeignKey
ALTER TABLE `product_inventories` DROP FOREIGN KEY `product_inventories_product_id_fkey`;

-- DropForeignKey
ALTER TABLE `product_orders` DROP FOREIGN KEY `product_orders_user_id_fkey`;

-- DropForeignKey
ALTER TABLE `product_reviews` DROP FOREIGN KEY `product_reviews_product_id_fkey`;

-- DropForeignKey
ALTER TABLE `product_reviews` DROP FOREIGN KEY `product_reviews_user_id_fkey`;

-- DropForeignKey
ALTER TABLE `product_variations` DROP FOREIGN KEY `product_variations_product_id_fkey`;

-- DropForeignKey
ALTER TABLE `products` DROP FOREIGN KEY `products_merchant_id_fkey`;

-- DropForeignKey
ALTER TABLE `sessions` DROP FOREIGN KEY `sessions_user_id_fkey`;

-- DropForeignKey
ALTER TABLE `shipping_histories` DROP FOREIGN KEY `shipping_histories_order_id_fkey`;

-- DropForeignKey
ALTER TABLE `shipping_histories` DROP FOREIGN KEY `shipping_histories_shipping_id_fkey`;

-- DropForeignKey
ALTER TABLE `shopping_carts` DROP FOREIGN KEY `shopping_carts_user_id_fkey`;

-- DropForeignKey
ALTER TABLE `subscriptions` DROP FOREIGN KEY `subscriptions_type_id_fkey`;

-- DropForeignKey
ALTER TABLE `subscriptions` DROP FOREIGN KEY `subscriptions_user_id_fkey`;

-- DropForeignKey
ALTER TABLE `user_media` DROP FOREIGN KEY `user_media_user_id_fkey`;

-- DropForeignKey
ALTER TABLE `virtual_mohalla_comments` DROP FOREIGN KEY `virtual_mohalla_comments_mohalla_id_fkey`;

-- AlterTable
ALTER TABLE `mails` ADD COLUMN `mail` VARCHAR(191) NOT NULL;

-- AddForeignKey
ALTER TABLE `accounts` ADD CONSTRAINT `accounts_user_id_fkey` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `sessions` ADD CONSTRAINT `sessions_user_id_fkey` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `admins` ADD CONSTRAINT `admins_user_id_fkey` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `admins` ADD CONSTRAINT `admins_role_id_fkey` FOREIGN KEY (`role_id`) REFERENCES `admin_roles`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `subscriptions` ADD CONSTRAINT `subscriptions_user_id_fkey` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `subscriptions` ADD CONSTRAINT `subscriptions_type_id_fkey` FOREIGN KEY (`type_id`) REFERENCES `subscription_types`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `contents` ADD CONSTRAINT `contents_category_id_fkey` FOREIGN KEY (`category_id`) REFERENCES `content_categories`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `content_images` ADD CONSTRAINT `content_images_content_id_fkey` FOREIGN KEY (`content_id`) REFERENCES `contents`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `content_videos` ADD CONSTRAINT `content_videos_content_id_fkey` FOREIGN KEY (`content_id`) REFERENCES `contents`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `contacts` ADD CONSTRAINT `contacts_type_id_fkey` FOREIGN KEY (`type_id`) REFERENCES `contact_types`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `virtual_mohalla_comments` ADD CONSTRAINT `virtual_mohalla_comments_mohalla_id_fkey` FOREIGN KEY (`mohalla_id`) REFERENCES `virtual_mohallas`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `posts` ADD CONSTRAINT `posts_created_by_id_fkey` FOREIGN KEY (`created_by_id`) REFERENCES `users`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `post_comments` ADD CONSTRAINT `post_comments_post_id_fkey` FOREIGN KEY (`post_id`) REFERENCES `posts`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `post_comments` ADD CONSTRAINT `post_comments_created_by_id_fkey` FOREIGN KEY (`created_by_id`) REFERENCES `users`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `post_videos` ADD CONSTRAINT `post_videos_post_id_fkey` FOREIGN KEY (`post_id`) REFERENCES `posts`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `post_likes` ADD CONSTRAINT `post_likes_post_id_fkey` FOREIGN KEY (`post_id`) REFERENCES `posts`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `post_likes` ADD CONSTRAINT `post_likes_user_id_fkey` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `post_images` ADD CONSTRAINT `post_images_post_id_fkey` FOREIGN KEY (`post_id`) REFERENCES `posts`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `forum_comments` ADD CONSTRAINT `forum_comments_forum_id_fkey` FOREIGN KEY (`forum_id`) REFERENCES `forums`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `forum_comments` ADD CONSTRAINT `forum_comments_created_by_id_fkey` FOREIGN KEY (`created_by_id`) REFERENCES `users`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `forum_suggestions` ADD CONSTRAINT `forum_suggestions_created_by_id_fkey` FOREIGN KEY (`created_by_id`) REFERENCES `users`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `classifieds` ADD CONSTRAINT `classifieds_created_by_id_fkey` FOREIGN KEY (`created_by_id`) REFERENCES `users`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `classified_images` ADD CONSTRAINT `classified_images_classified_id_fkey` FOREIGN KEY (`classified_id`) REFERENCES `classifieds`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `classified_queries` ADD CONSTRAINT `classified_queries_created_by_id_fkey` FOREIGN KEY (`created_by_id`) REFERENCES `users`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `classified_queries` ADD CONSTRAINT `classified_queries_classified_id_fkey` FOREIGN KEY (`classified_id`) REFERENCES `classifieds`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `classified_payments` ADD CONSTRAINT `classified_payments_classified_id_fkey` FOREIGN KEY (`classified_id`) REFERENCES `classifieds`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `care_giver_queries` ADD CONSTRAINT `care_giver_queries_user_id_fkey` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `care_giver_queries` ADD CONSTRAINT `care_giver_queries_care_giver_id_fkey` FOREIGN KEY (`care_giver_id`) REFERENCES `care_givers`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `products` ADD CONSTRAINT `products_merchant_id_fkey` FOREIGN KEY (`merchant_id`) REFERENCES `merchants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `product_inventories` ADD CONSTRAINT `product_inventories_product_id_fkey` FOREIGN KEY (`product_id`) REFERENCES `products`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `product_discounts` ADD CONSTRAINT `product_discounts_product_id_fkey` FOREIGN KEY (`product_id`) REFERENCES `products`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `product_images` ADD CONSTRAINT `product_images_product_id_fkey` FOREIGN KEY (`product_id`) REFERENCES `products`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `product_attributes` ADD CONSTRAINT `product_attributes_product_id_fkey` FOREIGN KEY (`product_id`) REFERENCES `products`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `product_variations` ADD CONSTRAINT `product_variations_product_id_fkey` FOREIGN KEY (`product_id`) REFERENCES `products`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `product_reviews` ADD CONSTRAINT `product_reviews_product_id_fkey` FOREIGN KEY (`product_id`) REFERENCES `products`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `product_reviews` ADD CONSTRAINT `product_reviews_user_id_fkey` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `product_orders` ADD CONSTRAINT `product_orders_user_id_fkey` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `order_items` ADD CONSTRAINT `order_items_order_id_fkey` FOREIGN KEY (`order_id`) REFERENCES `product_orders`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `order_items` ADD CONSTRAINT `order_items_product_id_fkey` FOREIGN KEY (`product_id`) REFERENCES `products`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `order_returns` ADD CONSTRAINT `order_returns_order_id_fkey` FOREIGN KEY (`order_id`) REFERENCES `product_orders`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `order_payments` ADD CONSTRAINT `order_payments_order_id_fkey` FOREIGN KEY (`order_id`) REFERENCES `product_orders`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `shopping_carts` ADD CONSTRAINT `shopping_carts_user_id_fkey` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `cart_items` ADD CONSTRAINT `cart_items_product_id_fkey` FOREIGN KEY (`product_id`) REFERENCES `products`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `cart_items` ADD CONSTRAINT `cart_items_shopping_cart_id_fkey` FOREIGN KEY (`shopping_cart_id`) REFERENCES `shopping_carts`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `order_shippings` ADD CONSTRAINT `order_shippings_order_id_fkey` FOREIGN KEY (`order_id`) REFERENCES `product_orders`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `shipping_histories` ADD CONSTRAINT `shipping_histories_order_id_fkey` FOREIGN KEY (`order_id`) REFERENCES `product_orders`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `shipping_histories` ADD CONSTRAINT `shipping_histories_shipping_id_fkey` FOREIGN KEY (`shipping_id`) REFERENCES `order_shippings`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `merchant_payments` ADD CONSTRAINT `merchant_payments_merchant_id_fkey` FOREIGN KEY (`merchant_id`) REFERENCES `merchants`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `learning_classes` ADD CONSTRAINT `learning_classes_category_id_fkey` FOREIGN KEY (`category_id`) REFERENCES `learning_categories`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `learning_classes` ADD CONSTRAINT `learning_classes_created_by_id_fkey` FOREIGN KEY (`created_by_id`) REFERENCES `users`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `learning_class_attributes` ADD CONSTRAINT `learning_class_attributes_class_id_fkey` FOREIGN KEY (`class_id`) REFERENCES `learning_classes`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `learning_class_images` ADD CONSTRAINT `learning_class_images_class_id_fkey` FOREIGN KEY (`class_id`) REFERENCES `learning_classes`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `learning_class_videos` ADD CONSTRAINT `learning_class_videos_class_id_fkey` FOREIGN KEY (`class_id`) REFERENCES `learning_classes`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `learning_class_reviews` ADD CONSTRAINT `learning_class_reviews_class_id_fkey` FOREIGN KEY (`class_id`) REFERENCES `learning_classes`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `learning_class_reviews` ADD CONSTRAINT `learning_class_reviews_user_id_fkey` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `ebook_comments` ADD CONSTRAINT `ebook_comments_ebook_id_fkey` FOREIGN KEY (`ebook_id`) REFERENCES `ebooks`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `ebook_comments` ADD CONSTRAINT `ebook_comments_user_id_fkey` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `user_media` ADD CONSTRAINT `user_media_user_id_fkey` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `news_updates` ADD CONSTRAINT `news_updates_category_id_fkey` FOREIGN KEY (`category_id`) REFERENCES `news_categories`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `news_updates` ADD CONSTRAINT `news_updates_created_by_id_fkey` FOREIGN KEY (`created_by_id`) REFERENCES `users`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE `news_images` ADD CONSTRAINT `news_images_news_update_id_fkey` FOREIGN KEY (`news_update_id`) REFERENCES `news_updates`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
