51 lines
2.3 KiB
SQL
51 lines
2.3 KiB
SQL
|
|
/*
|
||
|
|
Warnings:
|
||
|
|
|
||
|
|
- You are about to drop the `partner_account_quota_allocation` table. If the table is not empty, all the data it contains will be lost.
|
||
|
|
|
||
|
|
*/
|
||
|
|
-- DropForeignKey
|
||
|
|
ALTER TABLE `partner_account_quota_allocation` DROP FOREIGN KEY `partner_account_quota_allocation_charge_transaction_id_fkey`;
|
||
|
|
|
||
|
|
-- DropForeignKey
|
||
|
|
ALTER TABLE `partner_account_quota_allocation` DROP FOREIGN KEY `partner_account_quota_allocation_license_id_fkey`;
|
||
|
|
|
||
|
|
-- DropTable
|
||
|
|
DROP TABLE `partner_account_quota_allocation`;
|
||
|
|
|
||
|
|
-- CreateTable
|
||
|
|
CREATE TABLE `partner_account_quota_credit` (
|
||
|
|
`id` VARCHAR(191) NOT NULL,
|
||
|
|
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||
|
|
`updated_at` TIMESTAMP(0) NOT NULL,
|
||
|
|
`charge_transaction_id` VARCHAR(191) NOT NULL,
|
||
|
|
`allocation_id` VARCHAR(191) NULL,
|
||
|
|
|
||
|
|
UNIQUE INDEX `partner_account_quota_credit_allocation_id_key`(`allocation_id`),
|
||
|
|
PRIMARY KEY (`id`)
|
||
|
|
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||
|
|
|
||
|
|
-- CreateTable
|
||
|
|
CREATE TABLE `license_account_allocation` (
|
||
|
|
`id` VARCHAR(191) NOT NULL,
|
||
|
|
`created_at` TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||
|
|
`updated_at` TIMESTAMP(0) NOT NULL,
|
||
|
|
`license_activation_id` VARCHAR(191) NOT NULL,
|
||
|
|
`account_id` VARCHAR(191) NOT NULL,
|
||
|
|
|
||
|
|
UNIQUE INDEX `license_account_allocation_account_id_key`(`account_id`),
|
||
|
|
PRIMARY KEY (`id`)
|
||
|
|
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||
|
|
|
||
|
|
-- AddForeignKey
|
||
|
|
ALTER TABLE `partner_account_quota_credit` ADD CONSTRAINT `partner_account_quota_credit_charge_transaction_id_fkey` FOREIGN KEY (`charge_transaction_id`) REFERENCES `partner_account_quota_charge_transaction`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||
|
|
|
||
|
|
-- AddForeignKey
|
||
|
|
ALTER TABLE `partner_account_quota_credit` ADD CONSTRAINT `partner_account_quota_credit_allocation_id_fkey` FOREIGN KEY (`allocation_id`) REFERENCES `license_account_allocation`(`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||
|
|
|
||
|
|
-- AddForeignKey
|
||
|
|
ALTER TABLE `license_account_allocation` ADD CONSTRAINT `license_account_allocation_license_activation_id_fkey` FOREIGN KEY (`license_activation_id`) REFERENCES `licenses_activated`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||
|
|
|
||
|
|
-- AddForeignKey
|
||
|
|
ALTER TABLE `license_account_allocation` ADD CONSTRAINT `license_account_allocation_account_id_fkey` FOREIGN KEY (`account_id`) REFERENCES `consumer_accounts`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|