forked from ebhomengo/niki
20 lines
779 B
SQL
20 lines
779 B
SQL
-- +migrate Up
|
|
CREATE TABLE `carts` (
|
|
`id` BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
|
|
`user_id` BIGINT UNSIGNED NOT NULL,
|
|
`total_price` DECIMAL(10,2) DEFAULT 0,
|
|
`status` ENUM('active', 'expired', 'checked_out') NOT NULL DEFAULT 'active',
|
|
`expire_at` TIMESTAMP NOT NULL,
|
|
`created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
`deleted_at` TIMESTAMP NULL DEFAULT NULL,
|
|
`updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
|
);
|
|
|
|
CREATE INDEX `idx_carts_user_id` ON `carts`(`user_id`);
|
|
CREATE INDEX `idx_carts_id` ON `carts`(`id`);
|
|
|
|
-- +migrate Down
|
|
DROP INDEX `idx_carts_user_id` ON `carts`;
|
|
DROP INDEX `idx_carts_id` ON `carts`;
|
|
DROP TABLE `carts`;
|