88 lines
5.4 KiB
SQL
88 lines
5.4 KiB
SQL
|
|
/*
|
||
|
|
Warnings:
|
||
|
|
|
||
|
|
- You are about to drop the column `createdAt` on the `service_categories` table. All the data in the column will be lost.
|
||
|
|
- You are about to drop the column `deletedAt` on the `service_categories` table. All the data in the column will be lost.
|
||
|
|
- You are about to drop the column `imageUrl` on the `service_categories` table. All the data in the column will be lost.
|
||
|
|
- You are about to drop the column `updatedAt` on the `service_categories` table. All the data in the column will be lost.
|
||
|
|
- You are about to drop the column `baseSalePrice` on the `services` table. All the data in the column will be lost.
|
||
|
|
- You are about to drop the column `categoryId` on the `services` table. All the data in the column will be lost.
|
||
|
|
- You are about to drop the column `createdAt` on the `services` table. All the data in the column will be lost.
|
||
|
|
- You are about to drop the column `deletedAt` on the `services` table. All the data in the column will be lost.
|
||
|
|
- You are about to drop the column `updatedAt` on the `services` table. All the data in the column will be lost.
|
||
|
|
- A unique constraint covering the columns `[local_sku]` on the table `services` will be added. If there are existing duplicate values, this will fail.
|
||
|
|
- Added the required column `account_id` to the `customers` table without a default value. This is not possible if the table is not empty.
|
||
|
|
- Added the required column `complex_id` to the `customers` table without a default value. This is not possible if the table is not empty.
|
||
|
|
- Added the required column `account_id` to the `good_categories` table without a default value. This is not possible if the table is not empty.
|
||
|
|
- Added the required column `complex_id` to the `good_categories` table without a default value. This is not possible if the table is not empty.
|
||
|
|
- Added the required column `account_id` to the `goods` table without a default value. This is not possible if the table is not empty.
|
||
|
|
- Added the required column `complex_id` to the `goods` table without a default value. This is not possible if the table is not empty.
|
||
|
|
- Added the required column `account_id` to the `sales_invoices` table without a default value. This is not possible if the table is not empty.
|
||
|
|
- Added the required column `complex_id` to the `sales_invoices` table without a default value. This is not possible if the table is not empty.
|
||
|
|
- Added the required column `account_id` to the `service_categories` table without a default value. This is not possible if the table is not empty.
|
||
|
|
- Added the required column `complex_id` to the `service_categories` table without a default value. This is not possible if the table is not empty.
|
||
|
|
- Added the required column `updated_at` to the `service_categories` table without a default value. This is not possible if the table is not empty.
|
||
|
|
- Added the required column `account_id` to the `services` table without a default value. This is not possible if the table is not empty.
|
||
|
|
- Added the required column `complex_id` to the `services` table without a default value. This is not possible if the table is not empty.
|
||
|
|
- Added the required column `updated_at` to the `services` table without a default value. This is not possible if the table is not empty.
|
||
|
|
|
||
|
|
*/
|
||
|
|
-- DropForeignKey
|
||
|
|
ALTER TABLE `services` DROP FOREIGN KEY `services_categoryId_fkey`;
|
||
|
|
|
||
|
|
-- DropIndex
|
||
|
|
DROP INDEX `services_categoryId_idx` ON `services`;
|
||
|
|
|
||
|
|
-- AlterTable
|
||
|
|
ALTER TABLE `customers` ADD COLUMN `account_id` VARCHAR(191) NOT NULL,
|
||
|
|
ADD COLUMN `complex_id` VARCHAR(191) NOT NULL;
|
||
|
|
|
||
|
|
-- AlterTable
|
||
|
|
ALTER TABLE `good_categories` ADD COLUMN `account_id` VARCHAR(191) NOT NULL,
|
||
|
|
ADD COLUMN `complex_id` VARCHAR(191) NOT NULL;
|
||
|
|
|
||
|
|
-- AlterTable
|
||
|
|
ALTER TABLE `goods` ADD COLUMN `account_id` VARCHAR(191) NOT NULL,
|
||
|
|
ADD COLUMN `complex_id` VARCHAR(191) NOT NULL,
|
||
|
|
MODIFY `local_sku` VARCHAR(100) NULL;
|
||
|
|
|
||
|
|
-- AlterTable
|
||
|
|
ALTER TABLE `sales_invoices` ADD COLUMN `account_id` VARCHAR(191) NOT NULL,
|
||
|
|
ADD COLUMN `complex_id` VARCHAR(191) NOT NULL;
|
||
|
|
|
||
|
|
-- AlterTable
|
||
|
|
ALTER TABLE `service_categories` DROP COLUMN `createdAt`,
|
||
|
|
DROP COLUMN `deletedAt`,
|
||
|
|
DROP COLUMN `imageUrl`,
|
||
|
|
DROP COLUMN `updatedAt`,
|
||
|
|
ADD COLUMN `account_id` VARCHAR(191) NOT NULL,
|
||
|
|
ADD COLUMN `complex_id` VARCHAR(191) NOT NULL,
|
||
|
|
ADD COLUMN `created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||
|
|
ADD COLUMN `deleted_at` TIMESTAMP(0) NULL,
|
||
|
|
ADD COLUMN `image_url` VARCHAR(255) NULL,
|
||
|
|
ADD COLUMN `updated_at` TIMESTAMP(0) NOT NULL;
|
||
|
|
|
||
|
|
-- AlterTable
|
||
|
|
ALTER TABLE `services` DROP COLUMN `baseSalePrice`,
|
||
|
|
DROP COLUMN `categoryId`,
|
||
|
|
DROP COLUMN `createdAt`,
|
||
|
|
DROP COLUMN `deletedAt`,
|
||
|
|
DROP COLUMN `updatedAt`,
|
||
|
|
ADD COLUMN `account_id` VARCHAR(191) NOT NULL,
|
||
|
|
ADD COLUMN `base_sale_price` DECIMAL(15, 0) NOT NULL DEFAULT 0.00,
|
||
|
|
ADD COLUMN `category_id` VARCHAR(191) NULL,
|
||
|
|
ADD COLUMN `complex_id` VARCHAR(191) NOT NULL,
|
||
|
|
ADD COLUMN `created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||
|
|
ADD COLUMN `deleted_at` TIMESTAMP(0) NULL,
|
||
|
|
ADD COLUMN `local_sku` VARCHAR(100) NULL,
|
||
|
|
ADD COLUMN `updated_at` TIMESTAMP(0) NOT NULL;
|
||
|
|
|
||
|
|
-- CreateIndex
|
||
|
|
CREATE UNIQUE INDEX `services_local_sku_key` ON `services`(`local_sku`);
|
||
|
|
|
||
|
|
-- CreateIndex
|
||
|
|
CREATE INDEX `services_category_id_idx` ON `services`(`category_id`);
|
||
|
|
|
||
|
|
-- AddForeignKey
|
||
|
|
ALTER TABLE `services` ADD CONSTRAINT `services_category_id_fkey` FOREIGN KEY (`category_id`) REFERENCES `service_categories`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|