generated from yiisoft/package-template
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
44 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Yiisoft\Db\Migration\MigrationBuilder; | ||
use Yiisoft\Db\Migration\RevertibleMigrationInterface; | ||
use Yiisoft\Db\Migration\TransactionalMigrationInterface; | ||
|
||
final class M240409200600CreateQueueTable implements RevertibleMigrationInterface, TransactionalMigrationInterface | ||
{ | ||
private const QUEUE_TABLE = 'queue'; | ||
|
||
public function up(MigrationBuilder $b): void | ||
{ | ||
$b->createTable( | ||
self::QUEUE_TABLE, | ||
[ | ||
'id' => 'int NOT NULL AUTO_INCREMENT', | ||
'channel' => 'varchar(255) NOT NULL', | ||
'job' => 'blob NOT NULL', | ||
'pushed_at' => 'int NOT NULL', | ||
'ttr' => 'int NOT NULL', | ||
'delay' => 'int NOT NULL DEFAULT 0', | ||
'priority' => 'int UNSIGNED NOT NULL DEFAULT 1024', | ||
'reserved_at' => 'int DEFAULT NULL', | ||
'attempt' => 'int DEFAULT NULL', | ||
'done_at' => 'int DEFAULT NULL', | ||
'PRIMARY KEY ([[id]])', | ||
'KEY channel ([[channel]])', | ||
'KEY reserved_at ([[reserved_at]])', | ||
'KEY priority ([[priority]])', | ||
], | ||
); | ||
} | ||
|
||
public function down(MigrationBuilder $b): void | ||
{ | ||
$b->dropTable(self::QUEUE_TABLE); | ||
} | ||
} |