Add project
This commit is contained in:
22
config/Migrations/20251120194645_CreateTools.php
Normal file
22
config/Migrations/20251120194645_CreateTools.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Migrations\BaseMigration;
|
||||
class CreateTools extends BaseMigration
|
||||
{
|
||||
public function change(): void
|
||||
{
|
||||
$table = $this->table('tools')
|
||||
->addColumn('name', 'string', ['limit' => 150])
|
||||
->addColumn('description', 'text', ['null' => true])
|
||||
->addColumn('quantity', 'integer', ['default' => 1])
|
||||
->addColumn('active', 'boolean', ['default' => true])
|
||||
->addColumn('created', 'datetime')
|
||||
->addColumn('modified', 'datetime', ['null' => true])
|
||||
->create();
|
||||
}
|
||||
public function down(): void
|
||||
{
|
||||
$this->table('tools')->drop()->save();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user