| 1 |
<?php |
| 2 |
|
| 3 |
namespace FluentCart\Database\Migrations; |
| 4 |
|
| 5 |
|
| 6 |
use FluentCart\Framework\Database\Schema; |
| 7 |
|
| 8 |
class CouponsMigrator extends Migrator |
| 9 |
{ |
| 10 |
|
| 11 |
public static string $tableName = 'fct_coupons'; |
| 12 |
|
| 13 |
public static function getSqlSchema(): string |
| 14 |
{ |
| 15 |
$indexPrefix = static::getDbPrefix() . 'fct_cpn_'; |
| 16 |
return "`id` BIGINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, |
| 17 |
`title` VARCHAR(200) NOT NULL , |
| 18 |
`code` VARCHAR(50) NOT NULL UNIQUE , |
| 19 |
`priority` INT DEFAULT NULL, |
| 20 |
`type` VARCHAR(20) NOT NULL , |
| 21 |
`conditions` json NULL, |
| 22 |
`amount` double NOT NULL , |
| 23 |
`use_count` INT DEFAULT 0 , |
| 24 |
`status` VARCHAR(20) NOT NULL , |
| 25 |
`notes` LONGTEXT NOT NULL, |
| 26 |
`stackable` VARCHAR(3) NOT NULL DEFAULT 'no', |
| 27 |
`show_on_checkout` VARCHAR(3) NOT NULL DEFAULT 'yes', |
| 28 |
`start_date` TIMESTAMP NULL, |
| 29 |
`end_date` TIMESTAMP NULL, |
| 30 |
`created_at` DATETIME NULL, |
| 31 |
`updated_at` DATETIME NULL, |
| 32 |
|
| 33 |
INDEX `{$indexPrefix}_code_idx` (`code` ASC), |
| 34 |
INDEX `{$indexPrefix}_status_idx` (`status` ASC)"; |
| 35 |
} |
| 36 |
} |
| 37 |
|