diff --git a/upload-file-backend/src/main/resources/data.sql b/upload-file-backend/src/main/resources/data.sql new file mode 100644 index 0000000..0ba948f --- /dev/null +++ b/upload-file-backend/src/main/resources/data.sql @@ -0,0 +1,11 @@ +INSERT INTO storage_config (id, type, endpoint, access_key, secret_key, bucket) +SELECT 1, 'local', 'http://localhost:10086', '', '', 'E:\data' + WHERE NOT EXISTS (SELECT 1 FROM storage_config WHERE id = 1); + +INSERT INTO storage_config (id, type, endpoint, access_key, secret_key, bucket) +SELECT 2, 'minio', 'http://localhost:9000', 'minio', 'minio123', 'upload-file' + WHERE NOT EXISTS (SELECT 1 FROM storage_config WHERE id = 2); + +INSERT INTO storage_config (id, type, endpoint, access_key, secret_key, bucket) +SELECT 3, 'oss', 'https://oss-cn-guangzhou.aliyuncs.com', 'ossAccessKeyID', 'ossAccessKeySecret', 'yourBucket' + WHERE NOT EXISTS (SELECT 1 FROM storage_config WHERE id = 3); \ No newline at end of file diff --git a/upload-file-backend/src/main/resources/schema.sql b/upload-file-backend/src/main/resources/schema.sql new file mode 100644 index 0000000..c175238 --- /dev/null +++ b/upload-file-backend/src/main/resources/schema.sql @@ -0,0 +1,43 @@ +CREATE TABLE IF NOT EXISTS storage_config ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + type TEXT, + endpoint TEXT, + access_key TEXT, + secret_key TEXT, + bucket TEXT +); + +CREATE TABLE IF NOT EXISTS upload_file ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + upload_id TEXT NOT NULL, + file_identifier TEXT NOT NULL, + file_name TEXT NOT NULL, + object_key TEXT NOT NULL, + total_size INTEGER NOT NULL, + chunk_size INTEGER NOT NULL, + chunk_num INTEGER NOT NULL, + is_finish INTEGER NOT NULL, + content_type TEXT, + access_url TEXT, + download_url TEXT, + create_time INTEGER, + storage_type TEXT +); + +CREATE UNIQUE INDEX IF NOT EXISTS uq_file_identifier ON upload_file (file_identifier); +CREATE UNIQUE INDEX IF NOT EXISTS uq_upload_id ON upload_file (upload_id); + +CREATE TABLE IF NOT EXISTS "user_config" ( + "id" INTEGER PRIMARY KEY AUTOINCREMENT, + "username" TEXT NOT NULL DEFAULT 'admin', + "password" TEXT DEFAULT NULL, + "is_main_user" INTEGER NOT NULL DEFAULT 1, + "create_time" TEXT DEFAULT NULL +); + +CREATE TABLE IF NOT EXISTS "shared_file" ( + "id" INTEGER PRIMARY KEY AUTOINCREMENT, + "file_identifier" TEXT NOT NULL, + "create_time" TEXT DEFAULT NULL, + UNIQUE ("file_identifier") + ); \ No newline at end of file