Skip to content

File Metadata

The data structure design of file metadata can be customized and expanded as needed for the project.

Table Design

NameTypeLengthNot NullVirtualKeyComment
idbigint20TrueFalseTrueAuto-increment ID
file_keyvarchar50TrueFalseFile Key
file_md5varchar50FalseFalseFile MD5 Value
file_namevarchar255TrueFalseFile Name
file_mime_typevarchar128FalseFalseMIME Type
file_suffixvarchar20FalseFalseFile Suffix
file_sizebigint20FalseFalseFile Size
is_previewtinyint1FalseFalsePreview Available 0: No 1: Yes
is_privatetinyint1FalseFalseIs Private 0: No 1: Yes
bucketvarchar20TrueFalseBucket
bucket_pathvarchar20TrueFalseBucket Path
upload_idvarchar255FalseFalseUpload ID
is_finishedtinyint1TrueFalseStatus 0: Incomplete 1: Complete
is_parttinyint1FalseFalseIs Part 0: No 1: Yes
part_numberint4FalseFalseNumber of Parts
create_timedatetimeTrueFalseCreation Time
create_uservarchar255TrueFalseCreated By
update_timedatetimeTrueFalseUpdate Time
update_uservarchar255TrueFalseUpdated By

MySQL Script

CREATE TABLE `file_metadata_info` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'Primary Key',
  `file_key` varchar(50) NOT NULL COMMENT 'File Key',
  `file_md5` varchar(50) DEFAULT NULL COMMENT 'File MD5',
  `file_name` varchar(255) NOT NULL COMMENT 'File Name',
  `file_mime_type` varchar(128) DEFAULT NULL COMMENT 'MIME Type',
  `file_suffix` varchar(20) DEFAULT NULL COMMENT 'File Suffix',
  `file_size` bigint(20) DEFAULT NULL COMMENT 'File Size',
  `is_preview` tinyint(1) DEFAULT '0' COMMENT 'Preview Available 0: No 1: Yes',
  `is_private` tinyint(1) DEFAULT '0' COMMENT 'Is Private 0: No 1: Yes',
  `bucket` varchar(20) NOT NULL COMMENT 'Bucket',
  `bucket_path` varchar(20) NOT NULL COMMENT 'Bucket Path',
  `upload_id` varchar(255) DEFAULT NULL COMMENT 'Upload ID',
  `is_finished` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Status 0: Incomplete 1: Complete',
  `is_part` tinyint(1) DEFAULT NULL COMMENT 'Is Part 0: No 1: Yes',
  `part_number` int(4) DEFAULT NULL COMMENT 'Number of Parts',
  `create_time` datetime NOT NULL COMMENT 'Creation Time',
  `create_user` varchar(255) NOT NULL COMMENT 'Created By',
  `update_time` datetime NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT 'Update Time',
  `update_user` varchar(255) NOT NULL COMMENT 'Updated By',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `INDEX_KEY` (`file_key`),
  KEY `INDEX_MD5` (`file_md5`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='File Metadata Information Table';