25 lines
1.1 KiB
SQL
25 lines
1.1 KiB
SQL
|
|
/*
|
||
|
|
Warnings:
|
||
|
|
|
||
|
|
- You are about to drop the column `type` on the `sale_invoice_tsp_attempts` table. All the data in the column will be lost.
|
||
|
|
- A unique constraint covering the columns `[ref_id]` on the table `sales_invoices` will be added. If there are existing duplicate values, this will fail.
|
||
|
|
- Added the required column `type` to the `sales_invoices` table without a default value. This is not possible if the table is not empty.
|
||
|
|
|
||
|
|
*/
|
||
|
|
-- AlterTable
|
||
|
|
ALTER TABLE `sale_invoice_tsp_attempts` DROP COLUMN `type`;
|
||
|
|
|
||
|
|
-- AlterTable
|
||
|
|
ALTER TABLE `sales_invoices` ADD COLUMN `main_id` VARCHAR(50) NULL,
|
||
|
|
ADD COLUMN `ref_id` VARCHAR(50) NULL,
|
||
|
|
ADD COLUMN `type` ENUM('ORIGINAL', 'CORRECTION', 'REVOKE', 'RETURN') NOT NULL;
|
||
|
|
|
||
|
|
-- CreateIndex
|
||
|
|
CREATE UNIQUE INDEX `sales_invoices_ref_id_key` ON `sales_invoices`(`ref_id`);
|
||
|
|
|
||
|
|
-- CreateIndex
|
||
|
|
CREATE INDEX `sales_invoices_ref_id_idx` ON `sales_invoices`(`ref_id`);
|
||
|
|
|
||
|
|
-- AddForeignKey
|
||
|
|
ALTER TABLE `sales_invoices` ADD CONSTRAINT `sales_invoices_ref_id_fkey` FOREIGN KEY (`ref_id`) REFERENCES `sales_invoices`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|