Initial commit: Add CodeIgniter 4 QC application with full MVC structure
- CodeIgniter 4 framework setup with SQL Server database config
- Models: Control, Test, Dept, Result, Daily/ Monthly entry models
- Controllers: Dashboard, Control, Test, Dept, Entry, Report, API endpoints
- Views: CRUD pages with modal dialogs, dashboard, reports
- Database: Migrations for control test and daily/monthly result tables
- Legacy v1 PHP application preserved in /v1 directory
- Documentation: AGENTS.md, VIEWS_RULES.md for development guidelines
2026-01-14 16:49:27 +07:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Database\Migrations;
|
|
|
|
|
|
|
|
|
|
use CodeIgniter\Database\Migration;
|
|
|
|
|
|
|
|
|
|
class CreateCmodQcTables extends Migration
|
|
|
|
|
{
|
|
|
|
|
public function up()
|
|
|
|
|
{
|
|
|
|
|
$this->forge->addField([
|
|
|
|
|
'control_test_id' => [
|
|
|
|
|
'type' => 'INT',
|
|
|
|
|
'constraint' => 11,
|
|
|
|
|
'unsigned' => true,
|
|
|
|
|
'auto_increment' => true,
|
|
|
|
|
],
|
|
|
|
|
'control_ref_id' => [
|
|
|
|
|
'type' => 'INT',
|
|
|
|
|
'constraint' => 11,
|
|
|
|
|
'null' => true,
|
|
|
|
|
],
|
|
|
|
|
'test_ref_id' => [
|
|
|
|
|
'type' => 'INT',
|
|
|
|
|
'constraint' => 11,
|
|
|
|
|
'null' => true,
|
|
|
|
|
],
|
|
|
|
|
'mean' => [
|
|
|
|
|
'type' => 'FLOAT',
|
|
|
|
|
'null' => true,
|
|
|
|
|
],
|
|
|
|
|
'sd' => [
|
|
|
|
|
'type' => 'FLOAT',
|
|
|
|
|
'null' => true,
|
|
|
|
|
],
|
2026-01-15 10:44:09 +07:00
|
|
|
'created_at' => [
|
|
|
|
|
'type' => 'DATETIME',
|
|
|
|
|
'null' => true,
|
|
|
|
|
],
|
|
|
|
|
'updated_at' => [
|
|
|
|
|
'type' => 'DATETIME',
|
|
|
|
|
'null' => true,
|
|
|
|
|
],
|
|
|
|
|
'deleted_at' => [
|
|
|
|
|
'type' => 'DATETIME',
|
|
|
|
|
'null' => true,
|
|
|
|
|
],
|
Initial commit: Add CodeIgniter 4 QC application with full MVC structure
- CodeIgniter 4 framework setup with SQL Server database config
- Models: Control, Test, Dept, Result, Daily/ Monthly entry models
- Controllers: Dashboard, Control, Test, Dept, Entry, Report, API endpoints
- Views: CRUD pages with modal dialogs, dashboard, reports
- Database: Migrations for control test and daily/monthly result tables
- Legacy v1 PHP application preserved in /v1 directory
- Documentation: AGENTS.md, VIEWS_RULES.md for development guidelines
2026-01-14 16:49:27 +07:00
|
|
|
]);
|
|
|
|
|
$this->forge->addKey('control_test_id', true);
|
|
|
|
|
$this->forge->createTable('control_tests');
|
|
|
|
|
|
|
|
|
|
$this->forge->addField([
|
|
|
|
|
'result_id' => [
|
|
|
|
|
'type' => 'INT',
|
|
|
|
|
'constraint' => 11,
|
|
|
|
|
'unsigned' => true,
|
|
|
|
|
'auto_increment' => true,
|
|
|
|
|
],
|
|
|
|
|
'control_ref_id' => [
|
|
|
|
|
'type' => 'INT',
|
|
|
|
|
'constraint' => 11,
|
|
|
|
|
'null' => true,
|
|
|
|
|
],
|
|
|
|
|
'test_ref_id' => [
|
|
|
|
|
'type' => 'INT',
|
|
|
|
|
'constraint' => 11,
|
|
|
|
|
'null' => true,
|
|
|
|
|
],
|
|
|
|
|
'resdate' => [
|
|
|
|
|
'type' => 'DATETIME',
|
|
|
|
|
'null' => true,
|
|
|
|
|
],
|
|
|
|
|
'resvalue' => [
|
|
|
|
|
'type' => 'VARCHAR',
|
|
|
|
|
'constraint' => 50,
|
|
|
|
|
'null' => true,
|
|
|
|
|
],
|
|
|
|
|
'rescomment' => [
|
|
|
|
|
'type' => 'TEXT',
|
|
|
|
|
'null' => true,
|
|
|
|
|
],
|
2026-01-15 10:44:09 +07:00
|
|
|
'created_at' => [
|
|
|
|
|
'type' => 'DATETIME',
|
|
|
|
|
'null' => true,
|
|
|
|
|
],
|
|
|
|
|
'updated_at' => [
|
|
|
|
|
'type' => 'DATETIME',
|
|
|
|
|
'null' => true,
|
|
|
|
|
],
|
|
|
|
|
'deleted_at' => [
|
|
|
|
|
'type' => 'DATETIME',
|
|
|
|
|
'null' => true,
|
|
|
|
|
],
|
Initial commit: Add CodeIgniter 4 QC application with full MVC structure
- CodeIgniter 4 framework setup with SQL Server database config
- Models: Control, Test, Dept, Result, Daily/ Monthly entry models
- Controllers: Dashboard, Control, Test, Dept, Entry, Report, API endpoints
- Views: CRUD pages with modal dialogs, dashboard, reports
- Database: Migrations for control test and daily/monthly result tables
- Legacy v1 PHP application preserved in /v1 directory
- Documentation: AGENTS.md, VIEWS_RULES.md for development guidelines
2026-01-14 16:49:27 +07:00
|
|
|
]);
|
|
|
|
|
$this->forge->addKey('result_id', true);
|
|
|
|
|
$this->forge->createTable('results');
|
|
|
|
|
|
|
|
|
|
$this->forge->addField([
|
|
|
|
|
'control_id' => [
|
|
|
|
|
'type' => 'INT',
|
|
|
|
|
'constraint' => 11,
|
|
|
|
|
'unsigned' => true,
|
|
|
|
|
'auto_increment' => true,
|
|
|
|
|
],
|
|
|
|
|
'dept_ref_id' => [
|
|
|
|
|
'type' => 'INT',
|
|
|
|
|
'constraint' => 11,
|
|
|
|
|
'null' => true,
|
|
|
|
|
],
|
|
|
|
|
'name' => [
|
|
|
|
|
'type' => 'VARCHAR',
|
|
|
|
|
'constraint' => 50,
|
|
|
|
|
'null' => true,
|
|
|
|
|
],
|
|
|
|
|
'lot' => [
|
|
|
|
|
'type' => 'VARCHAR',
|
|
|
|
|
'constraint' => 50,
|
|
|
|
|
'null' => true,
|
|
|
|
|
],
|
|
|
|
|
'producer' => [
|
|
|
|
|
'type' => 'TEXT',
|
|
|
|
|
'null' => true,
|
|
|
|
|
],
|
|
|
|
|
'expdate' => [
|
|
|
|
|
'type' => 'DATE',
|
|
|
|
|
'null' => true,
|
|
|
|
|
],
|
2026-01-15 10:44:09 +07:00
|
|
|
'created_at' => [
|
|
|
|
|
'type' => 'DATETIME',
|
|
|
|
|
'null' => true,
|
|
|
|
|
],
|
|
|
|
|
'updated_at' => [
|
|
|
|
|
'type' => 'DATETIME',
|
|
|
|
|
'null' => true,
|
|
|
|
|
],
|
|
|
|
|
'deleted_at' => [
|
|
|
|
|
'type' => 'DATETIME',
|
|
|
|
|
'null' => true,
|
|
|
|
|
],
|
Initial commit: Add CodeIgniter 4 QC application with full MVC structure
- CodeIgniter 4 framework setup with SQL Server database config
- Models: Control, Test, Dept, Result, Daily/ Monthly entry models
- Controllers: Dashboard, Control, Test, Dept, Entry, Report, API endpoints
- Views: CRUD pages with modal dialogs, dashboard, reports
- Database: Migrations for control test and daily/monthly result tables
- Legacy v1 PHP application preserved in /v1 directory
- Documentation: AGENTS.md, VIEWS_RULES.md for development guidelines
2026-01-14 16:49:27 +07:00
|
|
|
]);
|
|
|
|
|
$this->forge->addKey('control_id', true);
|
|
|
|
|
$this->forge->createTable('dict_controls');
|
|
|
|
|
|
|
|
|
|
$this->forge->addField([
|
|
|
|
|
'dept_id' => [
|
|
|
|
|
'type' => 'INT',
|
|
|
|
|
'constraint' => 11,
|
|
|
|
|
'unsigned' => true,
|
|
|
|
|
'auto_increment' => true,
|
|
|
|
|
],
|
|
|
|
|
'name' => [
|
|
|
|
|
'type' => 'VARCHAR',
|
|
|
|
|
'constraint' => 50,
|
|
|
|
|
'null' => true,
|
|
|
|
|
],
|
2026-01-15 10:44:09 +07:00
|
|
|
'created_at' => [
|
|
|
|
|
'type' => 'DATETIME',
|
|
|
|
|
'null' => true,
|
|
|
|
|
],
|
|
|
|
|
'updated_at' => [
|
|
|
|
|
'type' => 'DATETIME',
|
|
|
|
|
'null' => true,
|
|
|
|
|
],
|
|
|
|
|
'deleted_at' => [
|
|
|
|
|
'type' => 'DATETIME',
|
|
|
|
|
'null' => true,
|
|
|
|
|
],
|
Initial commit: Add CodeIgniter 4 QC application with full MVC structure
- CodeIgniter 4 framework setup with SQL Server database config
- Models: Control, Test, Dept, Result, Daily/ Monthly entry models
- Controllers: Dashboard, Control, Test, Dept, Entry, Report, API endpoints
- Views: CRUD pages with modal dialogs, dashboard, reports
- Database: Migrations for control test and daily/monthly result tables
- Legacy v1 PHP application preserved in /v1 directory
- Documentation: AGENTS.md, VIEWS_RULES.md for development guidelines
2026-01-14 16:49:27 +07:00
|
|
|
]);
|
|
|
|
|
$this->forge->addKey('dept_id', true);
|
|
|
|
|
$this->forge->createTable('dict_depts');
|
|
|
|
|
|
|
|
|
|
$this->forge->addField([
|
|
|
|
|
'test_id' => [
|
|
|
|
|
'type' => 'INT',
|
|
|
|
|
'constraint' => 11,
|
|
|
|
|
'unsigned' => true,
|
|
|
|
|
'auto_increment' => true,
|
|
|
|
|
],
|
|
|
|
|
'dept_ref_id' => [
|
|
|
|
|
'type' => 'INT',
|
|
|
|
|
'constraint' => 11,
|
|
|
|
|
'null' => true,
|
|
|
|
|
],
|
|
|
|
|
'name' => [
|
|
|
|
|
'type' => 'VARCHAR',
|
|
|
|
|
'constraint' => 50,
|
|
|
|
|
'null' => true,
|
|
|
|
|
],
|
|
|
|
|
'unit' => [
|
|
|
|
|
'type' => 'VARCHAR',
|
|
|
|
|
'constraint' => 50,
|
|
|
|
|
'null' => true,
|
|
|
|
|
],
|
|
|
|
|
'method' => [
|
|
|
|
|
'type' => 'VARCHAR',
|
|
|
|
|
'constraint' => 50,
|
|
|
|
|
'null' => true,
|
|
|
|
|
],
|
|
|
|
|
'cva' => [
|
|
|
|
|
'type' => 'VARCHAR',
|
|
|
|
|
'constraint' => 50,
|
|
|
|
|
'null' => true,
|
|
|
|
|
],
|
|
|
|
|
'ba' => [
|
|
|
|
|
'type' => 'VARCHAR',
|
|
|
|
|
'constraint' => 50,
|
|
|
|
|
'null' => true,
|
|
|
|
|
],
|
|
|
|
|
'tea' => [
|
|
|
|
|
'type' => 'VARCHAR',
|
|
|
|
|
'constraint' => 50,
|
|
|
|
|
'null' => true,
|
|
|
|
|
],
|
2026-01-15 10:44:09 +07:00
|
|
|
'created_at' => [
|
|
|
|
|
'type' => 'DATETIME',
|
|
|
|
|
'null' => true,
|
|
|
|
|
],
|
|
|
|
|
'updated_at' => [
|
|
|
|
|
'type' => 'DATETIME',
|
|
|
|
|
'null' => true,
|
|
|
|
|
],
|
|
|
|
|
'deleted_at' => [
|
|
|
|
|
'type' => 'DATETIME',
|
|
|
|
|
'null' => true,
|
|
|
|
|
],
|
Initial commit: Add CodeIgniter 4 QC application with full MVC structure
- CodeIgniter 4 framework setup with SQL Server database config
- Models: Control, Test, Dept, Result, Daily/ Monthly entry models
- Controllers: Dashboard, Control, Test, Dept, Entry, Report, API endpoints
- Views: CRUD pages with modal dialogs, dashboard, reports
- Database: Migrations for control test and daily/monthly result tables
- Legacy v1 PHP application preserved in /v1 directory
- Documentation: AGENTS.md, VIEWS_RULES.md for development guidelines
2026-01-14 16:49:27 +07:00
|
|
|
]);
|
|
|
|
|
$this->forge->addKey('test_id', true);
|
|
|
|
|
$this->forge->createTable('dict_tests');
|
|
|
|
|
|
|
|
|
|
$this->forge->addField([
|
|
|
|
|
'result_comment_id' => [
|
|
|
|
|
'type' => 'INT',
|
|
|
|
|
'constraint' => 11,
|
|
|
|
|
'unsigned' => true,
|
|
|
|
|
'auto_increment' => true,
|
|
|
|
|
],
|
|
|
|
|
'control_ref_id' => [
|
|
|
|
|
'type' => 'INT',
|
|
|
|
|
'constraint' => 11,
|
|
|
|
|
'null' => true,
|
|
|
|
|
],
|
|
|
|
|
'test_ref_id' => [
|
|
|
|
|
'type' => 'INT',
|
|
|
|
|
'constraint' => 11,
|
|
|
|
|
'null' => true,
|
|
|
|
|
],
|
|
|
|
|
'commonth' => [
|
|
|
|
|
'type' => 'VARCHAR',
|
|
|
|
|
'constraint' => 7,
|
|
|
|
|
'null' => true,
|
|
|
|
|
],
|
|
|
|
|
'comtext' => [
|
|
|
|
|
'type' => 'TEXT',
|
|
|
|
|
'null' => true,
|
|
|
|
|
],
|
2026-01-15 10:44:09 +07:00
|
|
|
'created_at' => [
|
|
|
|
|
'type' => 'DATETIME',
|
|
|
|
|
'null' => true,
|
|
|
|
|
],
|
|
|
|
|
'updated_at' => [
|
|
|
|
|
'type' => 'DATETIME',
|
|
|
|
|
'null' => true,
|
|
|
|
|
],
|
|
|
|
|
'deleted_at' => [
|
|
|
|
|
'type' => 'DATETIME',
|
|
|
|
|
'null' => true,
|
|
|
|
|
],
|
Initial commit: Add CodeIgniter 4 QC application with full MVC structure
- CodeIgniter 4 framework setup with SQL Server database config
- Models: Control, Test, Dept, Result, Daily/ Monthly entry models
- Controllers: Dashboard, Control, Test, Dept, Entry, Report, API endpoints
- Views: CRUD pages with modal dialogs, dashboard, reports
- Database: Migrations for control test and daily/monthly result tables
- Legacy v1 PHP application preserved in /v1 directory
- Documentation: AGENTS.md, VIEWS_RULES.md for development guidelines
2026-01-14 16:49:27 +07:00
|
|
|
]);
|
|
|
|
|
$this->forge->addKey('result_comment_id', true);
|
|
|
|
|
$this->forge->createTable('result_comments');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function down()
|
|
|
|
|
{
|
|
|
|
|
$this->forge->dropTable('control_tests');
|
|
|
|
|
$this->forge->dropTable('results');
|
|
|
|
|
$this->forge->dropTable('dict_controls');
|
|
|
|
|
$this->forge->dropTable('dict_depts');
|
|
|
|
|
$this->forge->dropTable('dict_tests');
|
|
|
|
|
$this->forge->dropTable('result_comments');
|
|
|
|
|
}
|
|
|
|
|
}
|