-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
9 changed files
with
130 additions
and
52 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Bow\Console\Command; | ||
|
||
use Bow\Console\Color; | ||
use Bow\Console\Generator; | ||
use Bow\Support\Str; | ||
|
||
class GenerateDatabaseQueueCommand extends AbstractCommand | ||
{ | ||
/** | ||
* Generate session | ||
* | ||
* @return void | ||
*/ | ||
public function generate(): void | ||
{ | ||
$create_at = date("YmdHis"); | ||
$filename = sprintf("Version%s%sTable", $create_at, ucfirst(Str::camel('DatabaseQueue'))); | ||
|
||
$generator = new Generator( | ||
$this->setting->getMigrationDirectory(), | ||
$filename | ||
); | ||
|
||
$generator->write('model/queue', [ | ||
'className' => $filename | ||
]); | ||
|
||
echo Color::green('Queue migration created.'); | ||
} | ||
} |
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,28 @@ | ||
<?php | ||
|
||
use Bow\Database\Migration\Migration; | ||
use Bow\Database\Migration\SQLGenerator; | ||
|
||
class {className} extends Migration | ||
{ | ||
/** | ||
* Up Migration | ||
*/ | ||
public function up(): void | ||
{ | ||
$this->create("queues", function (SQLGenerator $table) { | ||
$table->addColumn('id', 'string', ['primary' => true]); | ||
$table->addColumn('time', 'timestamp'); | ||
$table->addColumn('data', 'text'); | ||
$table->addColumn('ip', 'string'); | ||
}); | ||
} | ||
|
||
/** | ||
* Rollback migration | ||
*/ | ||
public function rollback(): void | ||
{ | ||
$this->dropIfExists("sessions"); | ||
} | ||
} |
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
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
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