-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1713 from sspanel-uim/dev
Dev 20221212
- Loading branch information
Showing
13 changed files
with
476 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Phinx\Migration\AbstractMigration; | ||
|
||
final class MergeNodeOnlineLog extends AbstractMigration | ||
{ | ||
public function up(): void | ||
{ | ||
if ($this->hasTable('node_online_log')) { | ||
$this->table('node_online_log')->drop()->update(); | ||
} | ||
if (! $this->table('node')->hasColumn('online_user')) { | ||
$this->table('node') | ||
->addColumn('online_user', 'integer', [ 'comment' => '节点在线用户', 'default' => 0 ]) | ||
->save(); | ||
} | ||
} | ||
|
||
public function down(): void | ||
{ | ||
$this->table('node_online_log', [ 'id' => false, 'primary_key' => [ 'id' ]]) | ||
->addColumn('id', 'integer', [ 'identity' => true ]) | ||
->addColumn('node_id', 'integer', []) | ||
->addColumn('online_user', 'integer', []) | ||
->addColumn('log_time', 'integer', []) | ||
->addIndex([ 'node_id' ]) | ||
->addForeignKey('node_id', 'node', 'id', [ 'delete' => 'CASCADE', 'update' => 'CASCADE' ]) | ||
->create(); | ||
$this->table('node') | ||
->removeColumn('online_user') | ||
->save(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Phinx\Migration\AbstractMigration; | ||
|
||
final class GiftCardTable extends AbstractMigration | ||
{ | ||
public function up(): void | ||
{ | ||
if (! $this->hasTable('gift_card')) { | ||
$this->table('gift_card', [ 'id' => false, 'primary_key' => [ 'id' ]]) | ||
->addColumn('id', 'biginteger', [ 'identity' => true,'signed' => false ]) | ||
->addColumn('card', 'text', ['comment' => '卡号']) | ||
->addColumn('balance', 'integer', ['comment' => '余额']) | ||
->addColumn('create_time', 'integer', ['comment' => '创建时间']) | ||
->addColumn('status', 'integer', ['comment' => '使用状态']) | ||
->addColumn('use_time', 'integer', ['comment' => '使用时间']) | ||
->addColumn('use_user', 'integer', ['comment' => '使用用户']) | ||
->addIndex([ 'id' ]) | ||
->addIndex([ 'status' ]) | ||
->create(); | ||
} | ||
} | ||
|
||
public function down(): void | ||
{ | ||
$this->table('gift_card')->drop()->update(); | ||
} | ||
} |
Oops, something went wrong.