sync
This commit is contained in:
@@ -1,7 +0,0 @@
|
||||
-- Add expires_at column to pending_orders table for 10-minute reservation timeout
|
||||
ALTER TABLE `pending_orders`
|
||||
ADD COLUMN `expires_at` datetime NOT NULL DEFAULT (DATE_ADD(NOW(), INTERVAL 10 MINUTE));
|
||||
|
||||
-- Add index on expires_at for efficient cleanup queries
|
||||
CREATE INDEX `idx_expires_at` ON `pending_orders` (`expires_at`);
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
-- Migration: Add image_url column to drops table
|
||||
-- Run this to add support for image uploads
|
||||
|
||||
ALTER TABLE `drops`
|
||||
ADD COLUMN `image_url` VARCHAR(255) DEFAULT NULL AFTER `unit`;
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
-- Add start_time column to drops table
|
||||
ALTER TABLE `drops`
|
||||
ADD COLUMN `start_time` datetime DEFAULT NULL AFTER `created_at`;
|
||||
|
||||
-- Update existing drops to have start_time = created_at (so they're immediately available)
|
||||
UPDATE `drops` SET `start_time` = `created_at` WHERE `start_time` IS NULL;
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
-- Migration: Create drop_images table for multiple images per drop
|
||||
-- This allows up to 4 images per drop
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `drop_images` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`drop_id` int(11) NOT NULL,
|
||||
`image_url` varchar(255) NOT NULL,
|
||||
`display_order` int(11) NOT NULL DEFAULT 0,
|
||||
`created_at` datetime NOT NULL DEFAULT current_timestamp(),
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `drop_id` (`drop_id`),
|
||||
CONSTRAINT `drop_images_ibfk_1` FOREIGN KEY (`drop_id`) REFERENCES `drops` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
|
||||
-- Add index for faster queries
|
||||
CREATE INDEX idx_drop_images_drop_order ON drop_images(drop_id, display_order);
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
-- Create pending_orders table to store invoice info before payment confirmation
|
||||
CREATE TABLE IF NOT EXISTS `pending_orders` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`payment_id` varchar(255) NOT NULL,
|
||||
`order_id` varchar(255) NOT NULL,
|
||||
`drop_id` int(11) NOT NULL,
|
||||
`buyer_id` int(11) NOT NULL,
|
||||
`size` int(11) NOT NULL,
|
||||
`price_amount` decimal(10,2) NOT NULL,
|
||||
`price_currency` varchar(10) NOT NULL DEFAULT 'chf',
|
||||
`created_at` datetime NOT NULL DEFAULT current_timestamp(),
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `payment_id` (`payment_id`),
|
||||
UNIQUE KEY `order_id` (`order_id`),
|
||||
KEY `drop_id` (`drop_id`),
|
||||
KEY `buyer_id` (`buyer_id`),
|
||||
CONSTRAINT `pending_orders_ibfk_1` FOREIGN KEY (`drop_id`) REFERENCES `drops` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `pending_orders_ibfk_2` FOREIGN KEY (`buyer_id`) REFERENCES `buyers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
|
||||
Reference in New Issue
Block a user