feat: Add PK and index management APIs for table management

- Implemented new API endpoints for managing primary keys and indexes in the table management system.
- Added functionality to retrieve table constraints, set primary keys, toggle indexes, and manage NOT NULL constraints.
- Enhanced the frontend to support PK and index management, including loading constraints and handling user interactions for toggling indexes and setting primary keys.
- Improved error handling and logging for better debugging and user feedback during these operations.
This commit is contained in:
kjs
2026-02-11 16:07:44 +09:00
parent 2bbb5d7013
commit e065835c4d
3 changed files with 529 additions and 142 deletions

View File

@@ -28,6 +28,10 @@ import {
multiTableSave, // 🆕 범용 다중 테이블 저장
getTableEntityRelations, // 🆕 두 테이블 간 엔티티 관계 조회
getReferencedByTables, // 🆕 현재 테이블을 참조하는 테이블 조회
getTableConstraints, // 🆕 PK/인덱스 상태 조회
setTablePrimaryKey, // 🆕 PK 설정
toggleTableIndex, // 🆕 인덱스 토글
toggleColumnNullable, // 🆕 NOT NULL 토글
} from "../controllers/tableManagementController";
const router = express.Router();
@@ -133,6 +137,30 @@ router.put("/tables/:tableName/columns/batch", updateAllColumnSettings);
*/
router.get("/tables/:tableName/schema", getTableSchema);
/**
* PK/인덱스 제약조건 상태 조회
* GET /api/table-management/tables/:tableName/constraints
*/
router.get("/tables/:tableName/constraints", getTableConstraints);
/**
* PK 설정 (기존 PK DROP 후 재생성)
* PUT /api/table-management/tables/:tableName/primary-key
*/
router.put("/tables/:tableName/primary-key", setTablePrimaryKey);
/**
* 인덱스 토글 (생성/삭제)
* POST /api/table-management/tables/:tableName/indexes
*/
router.post("/tables/:tableName/indexes", toggleTableIndex);
/**
* NOT NULL 토글
* PUT /api/table-management/tables/:tableName/columns/:columnName/nullable
*/
router.put("/tables/:tableName/columns/:columnName/nullable", toggleColumnNullable);
/**
* 테이블 존재 여부 확인
* GET /api/table-management/tables/:tableName/exists