Initial commit: Material Texture API service

- Go + Gin + GORM + PostgreSQL backend
- RESTful API for material management
- Docker deployment support
- Database partitioning for billion-scale data
- API documentation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
likegears
2025-12-11 15:29:49 +08:00
commit 85ba15c564
31 changed files with 1518167 additions and 0 deletions

37
migrations/001_init.sql Normal file
View File

@@ -0,0 +1,37 @@
-- 材质管理系统初始化脚本
-- 此脚本由GORM AutoMigrate自动执行仅作参考
-- 材质表
CREATE TABLE IF NOT EXISTS materials (
id BIGSERIAL PRIMARY KEY,
name VARCHAR(255) NOT NULL,
diffuse_r FLOAT NOT NULL DEFAULT 0,
diffuse_g FLOAT NOT NULL DEFAULT 0,
diffuse_b FLOAT NOT NULL DEFAULT 0,
alpha FLOAT NOT NULL DEFAULT 1,
shininess FLOAT NOT NULL DEFAULT 0,
specular_r FLOAT NOT NULL DEFAULT 0,
specular_g FLOAT NOT NULL DEFAULT 0,
specular_b FLOAT NOT NULL DEFAULT 0,
ambient_r FLOAT NOT NULL DEFAULT 0,
ambient_g FLOAT NOT NULL DEFAULT 0,
ambient_b FLOAT NOT NULL DEFAULT 0,
metallic FLOAT NOT NULL DEFAULT 0,
roughness FLOAT NOT NULL DEFAULT 0.5,
reflectance FLOAT NOT NULL DEFAULT 0.5,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- 材质绑定表
CREATE TABLE IF NOT EXISTS material_bindings (
id BIGSERIAL PRIMARY KEY,
material_id BIGINT NOT NULL REFERENCES materials(id) ON DELETE CASCADE,
group_id VARCHAR(255) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- 索引
CREATE INDEX IF NOT EXISTS idx_bindings_material_id ON material_bindings(material_id);
CREATE INDEX IF NOT EXISTS idx_bindings_group_id ON material_bindings(group_id);
CREATE UNIQUE INDEX IF NOT EXISTS idx_unique_material_group ON material_bindings(material_id, group_id);