26 lines
1.0 KiB
SQL
26 lines
1.0 KiB
SQL
-- Gallery table for encrypted image uploads
|
|
-- Run this SQL to create/update the gallery table
|
|
|
|
-- Drop old table if exists and recreate
|
|
DROP TABLE IF EXISTS `gallery`;
|
|
|
|
CREATE TABLE `gallery` (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`user_id` int(11) NOT NULL,
|
|
`filename` varchar(255) NOT NULL,
|
|
`thumb_filename` varchar(255) NOT NULL,
|
|
`title` varchar(255) NOT NULL,
|
|
`description` text,
|
|
`is_public` tinyint(1) NOT NULL DEFAULT 1,
|
|
`file_size` int(11) NOT NULL DEFAULT 0,
|
|
`mime_type` varchar(100) NOT NULL,
|
|
`encryption_key` varchar(64) NOT NULL,
|
|
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
PRIMARY KEY (`id`),
|
|
KEY `user_id` (`user_id`),
|
|
KEY `is_public` (`is_public`),
|
|
KEY `created_at` (`created_at`),
|
|
CONSTRAINT `gallery_user_fk` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|