update company table

This commit is contained in:
2025-11-11 09:11:13 +08:00
parent faefb94d1d
commit 34415a3a7f
2 changed files with 18 additions and 7 deletions
+15 -4
View File
@@ -7,14 +7,13 @@ namespace App\Model;
use Hyperf\DbConnection\Model\Model; use Hyperf\DbConnection\Model\Model;
/** /**
* @property int $id * @property int $id 公司ID(来自远程)
* @property string $name 公司名 英文 * @property string $name 公司名 英文
* @property string $label 公司名 中文 * @property string $label 公司名 中文
* @property boolean $enabled 激活状态 * @property boolean $enabled 激活状态
* @property string $ext 额外信息 * @property array $ext 额外信息
* @property \Carbon\Carbon $created_at * @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at * @property \Carbon\Carbon $updated_at
* @mixin \App_Model_Company
*/ */
class Company extends Model class Company extends Model
{ {
@@ -23,6 +22,12 @@ class Company extends Model
*/ */
protected ?string $table = 'companies'; protected ?string $table = 'companies';
/**
* Indicates if the IDs are auto-incrementing.
* 由于 ID 来自远程系统,禁用自增
*/
public bool $incrementing = false;
/** /**
* The attributes that are mass assignable. * The attributes that are mass assignable.
*/ */
@@ -31,5 +36,11 @@ class Company extends Model
/** /**
* The attributes that should be cast to native types. * The attributes that should be cast to native types.
*/ */
protected array $casts = ['id' => 'integer', 'enabled' => 'boolean', 'created_at' => 'datetime', 'updated_at' => 'datetime']; protected array $casts = [
'id' => 'integer',
'enabled' => 'boolean',
'ext' => 'array',
'created_at' => 'datetime',
'updated_at' => 'datetime',
];
} }
@@ -12,7 +12,7 @@ return new class extends Migration
public function up(): void public function up(): void
{ {
Schema::create('companies', function (Blueprint $table) { Schema::create('companies', function (Blueprint $table) {
$table->bigIncrements('id'); $table->bigInteger('id')->primary()->comment('公司ID(来自远程)');
$table->string('name')->unique()->comment('公司名 英文'); $table->string('name')->unique()->comment('公司名 英文');
$table->string('label')->nullable()->default('null')->comment('公司名 中文'); $table->string('label')->nullable()->default('null')->comment('公司名 中文');
$table->boolean('enabled')->default('true')->comment('激活状态'); $table->boolean('enabled')->default('true')->comment('激活状态');