Closed mdeslippe closed 1 year ago
Overview
files
File Information that Should be Stored in the Database
id
user_id
file_created_at
mime_type
name
data
SQL
CREATE TABLE `files` ( `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, `user_id` BIGINT(20) UNSIGNED NOT NULL, `file_created_at` TIMESTAMP NOT NULL DEFAULT current_timestamp(), `mime_type` VARCHAR(1024) NOT NULL COLLATE 'utf8mb4_unicode_ci', `name` VARCHAR(1024) NOT NULL COLLATE 'utf8mb4_unicode_ci', `data` LONGBLOB NOT NULL, PRIMARY KEY (`id`) USING BTREE, INDEX `FK__users` (`user_id`) USING BTREE, CONSTRAINT `FK__users` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON UPDATE NO ACTION ON DELETE CASCADE ) COLLATE='utf8mb4_unicode_ci' ENGINE=InnoDB ROW_FORMAT=COMPRESSED AUTO_INCREMENT=1;
Overview
files
table to the database (make sure it supports Unicode).File Information that Should be Stored in the Database
id
- An identifier that uniquely identifies the file.user_id
- The identifier of the user that the file belongs to.file_created_at
- A timestamp of when the file was created.mime_type
- The file's MIME type.name
- The name of the file, which includes the file extention.data
- The data contained in the file.SQL