33 lines
1.4 KiB
SQL
33 lines
1.4 KiB
SQL
/*
|
|
Warnings:
|
|
|
|
- You are about to drop the `consumer_devices` table. If the table is not empty, all the data it contains will be lost.
|
|
|
|
*/
|
|
-- DropForeignKey
|
|
ALTER TABLE `consumer_devices` DROP FOREIGN KEY `consumer_devices_consumer_id_fkey`;
|
|
|
|
-- DropTable
|
|
DROP TABLE `consumer_devices`;
|
|
|
|
-- CreateTable
|
|
CREATE TABLE `consumer_account_device` (
|
|
`id` VARCHAR(191) NOT NULL,
|
|
`device_id` VARCHAR(191) NOT NULL,
|
|
`device_name` VARCHAR(191) NULL,
|
|
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
|
`updated_at` TIMESTAMP(0) NOT NULL,
|
|
`consumer_account_id` VARCHAR(191) NOT NULL,
|
|
|
|
UNIQUE INDEX `consumer_account_device_device_id_key`(`device_id`),
|
|
UNIQUE INDEX `consumer_account_device_consumer_account_id_key`(`consumer_account_id`),
|
|
INDEX `consumer_account_device_consumer_account_id_idx`(`consumer_account_id`),
|
|
PRIMARY KEY (`id`)
|
|
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
|
|
|
-- AddForeignKey
|
|
ALTER TABLE `consumer_account_device` ADD CONSTRAINT `consumer_account_device_consumer_account_id_fkey` FOREIGN KEY (`consumer_account_id`) REFERENCES `consumer_accounts`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
|
|
-- AddForeignKey
|
|
ALTER TABLE `sale_invoice_tsp_attempts` ADD CONSTRAINT `sale_invoice_tsp_attempts_invoice_id_fkey` FOREIGN KEY (`invoice_id`) REFERENCES `sales_invoices`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|