feat: 添加 business_trip_itinerary 表迁移文件
记录出差行程明细表的数据库结构。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use support\Db;
|
||||
|
||||
return new class
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Db::statement('
|
||||
CREATE TABLE IF NOT EXISTS `business_trip_itinerary` (
|
||||
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT \'行程ID\',
|
||||
`business_trip_id` bigint unsigned NOT NULL COMMENT \'出差申请ID\',
|
||||
`start_time` datetime NOT NULL COMMENT \'开始时间\',
|
||||
`end_time` datetime DEFAULT NULL COMMENT \'结束时间\',
|
||||
`departure` varchar(100) DEFAULT NULL COMMENT \'出发地\',
|
||||
`destination` varchar(100) NOT NULL COMMENT \'目的地\',
|
||||
`transport` varchar(50) DEFAULT NULL COMMENT \'交通方式\',
|
||||
`trip_type` varchar(20) DEFAULT \'oneway\' COMMENT \'行程类型 oneway/roundtrip\',
|
||||
`remark` varchar(255) DEFAULT NULL COMMENT \'备注\',
|
||||
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT \'创建时间\',
|
||||
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT \'更新时间\',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_business_trip_id` (`business_trip_id`),
|
||||
KEY `idx_date` (`start_time`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT=\'出差行程明细表\'
|
||||
');
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Db::statement('DROP TABLE IF EXISTS `business_trip_itinerary`');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user