Files
material_texture/migrations/001_init.sql
likegears 85ba15c564 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>
2025-12-11 15:29:49 +08:00

38 lines
1.5 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- 材质管理系统初始化脚本
-- 此脚本由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);