feat: 작업장 관리 기능 추가 (공장-작업장 계층 구조)
- 공장(카테고리) 및 작업장 CRUD API 구현 - 탭 기반 UI로 공장별 작업장 필터링 - 터치 최적화된 관리자 페이지 - DB 테이블: workplace_categories, workplaces - 관리자 메뉴에 작업장 관리 추가 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* 작업장 카테고리(공장) 테이블 생성 마이그레이션
|
||||
* 대분류: 제 1공장, 제 2공장 등
|
||||
*/
|
||||
|
||||
exports.up = function(knex) {
|
||||
return knex.schema.createTable('workplace_categories', function(table) {
|
||||
table.increments('category_id').primary().comment('카테고리 ID');
|
||||
table.string('category_name', 100).notNullable().comment('카테고리명 (예: 제 1공장)');
|
||||
table.text('description').nullable().comment('설명');
|
||||
table.integer('display_order').defaultTo(0).comment('표시 순서');
|
||||
table.boolean('is_active').defaultTo(true).comment('활성화 여부');
|
||||
table.timestamp('created_at').defaultTo(knex.fn.now()).comment('생성일시');
|
||||
table.timestamp('updated_at').defaultTo(knex.fn.now()).comment('수정일시');
|
||||
|
||||
// 인덱스
|
||||
table.index('is_active');
|
||||
table.index('display_order');
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function(knex) {
|
||||
return knex.schema.dropTableIfExists('workplace_categories');
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* 작업장(작업 구역) 테이블 생성 마이그레이션
|
||||
* 소분류: 서스작업장, 조립구역 등
|
||||
*/
|
||||
|
||||
exports.up = function(knex) {
|
||||
return knex.schema.createTable('workplaces', function(table) {
|
||||
table.increments('workplace_id').primary().comment('작업장 ID');
|
||||
table.integer('category_id').unsigned().nullable().comment('카테고리 ID (공장)');
|
||||
table.string('workplace_name', 255).notNullable().comment('작업장명');
|
||||
table.text('description').nullable().comment('설명');
|
||||
table.boolean('is_active').defaultTo(true).comment('활성화 여부');
|
||||
table.timestamp('created_at').defaultTo(knex.fn.now()).comment('생성일시');
|
||||
table.timestamp('updated_at').defaultTo(knex.fn.now()).comment('수정일시');
|
||||
|
||||
// 외래키
|
||||
table.foreign('category_id')
|
||||
.references('category_id')
|
||||
.inTable('workplace_categories')
|
||||
.onDelete('SET NULL')
|
||||
.onUpdate('CASCADE');
|
||||
|
||||
// 인덱스
|
||||
table.index('category_id');
|
||||
table.index('is_active');
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = function(knex) {
|
||||
return knex.schema.dropTableIfExists('workplaces');
|
||||
};
|
||||
Reference in New Issue
Block a user