251220:1705 On going update to 1.7.0: Revise Schema
This commit is contained in:
@@ -8,3 +8,5 @@ node_modules/
|
||||
logs/
|
||||
design_specs/
|
||||
legacy_code/
|
||||
|
||||
//"@jarhed/server-mysql",
|
||||
|
||||
@@ -7,7 +7,7 @@ services:
|
||||
MYSQL_ROOT_PASSWORD: Center#2025
|
||||
MYSQL_DATABASE: lcbp3_dev
|
||||
MYSQL_USER: admin
|
||||
MYSQL_PASSWORD: Center2025
|
||||
MYSQL_PASSWORD: Center#2025
|
||||
ports:
|
||||
- '3306:3306'
|
||||
volumes:
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
"example": "examples"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"start:mcp": "node ./scripts/start-mcp.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
32
scripts/start-mcp.js
Normal file
32
scripts/start-mcp.js
Normal file
@@ -0,0 +1,32 @@
|
||||
// scripts/start-mcp.js
|
||||
const { spawn } = require('child_process');
|
||||
const path = require('path');
|
||||
const os = require('os');
|
||||
|
||||
// Resolve the external config file (outside the repo)
|
||||
const configPath = path.resolve(os.homedir(), '.gemini', 'antigravity', 'mcp_config.json');
|
||||
|
||||
// Load the JSON config (will throw if invalid)
|
||||
const config = require(configPath);
|
||||
|
||||
function runServer(name, command, args, env = {}) {
|
||||
console.log(`▶️ Starting ${name}…`);
|
||||
const fullCmd = process.platform === 'win32' ? `${command}.cmd` : command;
|
||||
const proc = spawn(fullCmd, args, {
|
||||
stdio: 'inherit',
|
||||
env: { ...process.env, ...env },
|
||||
cwd: process.cwd(),
|
||||
shell: true,
|
||||
});
|
||||
proc.on('close', (code) => {
|
||||
if (code !== 0) {
|
||||
console.error(`❌ ${name} exited with code ${code}`);
|
||||
} else {
|
||||
console.log(`✅ ${name} finished`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Object.entries(config.mcpServers).forEach(([name, srv]) => {
|
||||
runServer(name, srv.command, srv.args, srv.env);
|
||||
});
|
||||
@@ -716,6 +716,7 @@ CREATE TABLE contract_drawing_sub_cats (
|
||||
|
||||
-- ตารางเชื่อมระหว่าง หมวดหมู่หลัก-ย่อย (M:N)
|
||||
CREATE TABLE contract_drawing_subcat_cat_maps (
|
||||
id INT PRIMARY KEY AUTO_INCREMENT COMMENT 'ID ของตาราง',
|
||||
project_id INT COMMENT 'ID ของโครงการ',
|
||||
sub_cat_id INT COMMENT 'ID ของหมวดหมู่ย่อย',
|
||||
cat_id INT COMMENT 'ID ของหมวดหมู่หลัก',
|
||||
@@ -735,14 +736,15 @@ CREATE TABLE contract_drawings (
|
||||
project_id INT NOT NULL COMMENT 'โครงการ',
|
||||
condwg_no VARCHAR(255) NOT NULL COMMENT 'เลขที่แบบสัญญา',
|
||||
title VARCHAR(255) NOT NULL COMMENT 'ชื่อแบบสัญญา',
|
||||
sub_cat_id INT COMMENT 'หมวดหมู่ย่อย',
|
||||
map_cat_id INT COMMENT 'หมวดหมู่ย่อย',
|
||||
volume_id INT COMMENT 'เล่ม',
|
||||
volume_page INT COMMENT 'หน้าที่',
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT 'วันที่สร้าง',
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'วันที่แก้ไขล่าสุด',
|
||||
deleted_at DATETIME NULL COMMENT 'วันที่ลบ',
|
||||
updated_by INT COMMENT 'ผู้แก้ไขล่าสุด',
|
||||
FOREIGN KEY (project_id) REFERENCES projects (id) ON DELETE CASCADE,
|
||||
FOREIGN KEY (sub_cat_id) REFERENCES contract_drawing_sub_cats (id) ON DELETE RESTRICT,
|
||||
FOREIGN KEY (map_cat_id) REFERENCES contract_drawing_subcat_cat_maps (id) ON DELETE RESTRICT,
|
||||
FOREIGN KEY (volume_id) REFERENCES contract_drawing_volumes (id) ON DELETE RESTRICT,
|
||||
UNIQUE KEY ux_condwg_no_project (project_id, condwg_no)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'ตาราง Master เก็บข้อมูล "แบบคู่สัญญา"';
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
3
specs/09-history/2025-12-20-Revise-Schema.md
Normal file
3
specs/09-history/2025-12-20-Revise-Schema.md
Normal file
@@ -0,0 +1,3 @@
|
||||
TABLE contract_drawings: change sub_cat_id -> map_cat_id
|
||||
add volume_page INT COMMENT 'หน้าที่',
|
||||
TABLE contract_drawing_subcat_cat_maps: alter id INT PRIMARY KEY AUTO_INCREMENT COMMENT 'ID ของตาราง',
|
||||
Reference in New Issue
Block a user