/*
  Warnings:

  - You are about to drop the `baseSettings` table. If the table is not empty, all the data it contains will be lost.
  - You are about to drop the `urlSettings` table. If the table is not empty, all the data it contains will be lost.

*/


-- CreateTable
CREATE TABLE `baseSettings` (
    `id` INTEGER NOT NULL AUTO_INCREMENT,
    `header` LONGTEXT NOT NULL,
    `saleMode` BOOLEAN NOT NULL DEFAULT false,
    `startBalance` INTEGER NOT NULL,
    `mainPage` LONGTEXT NOT NULL,
    `apiKey` LONGTEXT NOT NULL,
    `IPWhiteList` LONGTEXT NOT NULL,
    `panelURLs` JSON NULL,

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

-- CreateTable
CREATE TABLE `urlSettings` (
    `id` INTEGER NOT NULL AUTO_INCREMENT,
    `icon` LONGTEXT NULL,
    `text` LONGTEXT NULL,
    `typeUrl` ENUM('SITE_SECTION', 'CUSTOM_PAGE', 'EXTERNAL_LINK', 'DROPDOWN_LIST') NOT NULL DEFAULT 'CUSTOM_PAGE',
    `url` LONGTEXT NOT NULL,
    `hidden` BOOLEAN NOT NULL DEFAULT true,
    `sections` JSON NULL,
    `isHaveSidebar` BOOLEAN NULL,

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

-- CreateTable
CREATE TABLE `Orders` (
    `id` INTEGER NOT NULL AUTO_INCREMENT,
    `userId` INTEGER NULL,
    `createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),

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

-- AddForeignKey
ALTER TABLE `Orders` ADD CONSTRAINT `Orders_userId_fkey` FOREIGN KEY (`userId`) REFERENCES `User`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
