28 lines
999 B
PHP
28 lines
999 B
PHP
<?php
|
|
|
|
use Phinx\Migration\AbstractMigration;
|
|
|
|
class CreateProductsTable extends AbstractMigration
|
|
{
|
|
|
|
public function change()
|
|
{
|
|
$this->table('products')
|
|
->addColumn('name', 'string',['limit' => 60])
|
|
->addColumn('slug', 'string')
|
|
->addColumn('quantite', 'integer')
|
|
->addColumn('prix', 'float')
|
|
->addColumn('content', 'text', ['limit' => 3000])
|
|
->addColumn('image','string',['limit' => 255 ])
|
|
->addColumn('created_at', 'datetime', ['null' => true])
|
|
->addColumn('updated_at', 'datetime', ['null' => true])
|
|
->addColumn('sold_at', 'datetime', ['null' => true])
|
|
->addColumn('acheteur_id', 'integer', ['null' => true])
|
|
->addColumn('user_id', 'integer')
|
|
->addForeignKey('user_id', 'users', 'id')
|
|
->addColumn('antenne_id', 'integer')
|
|
->addForeignKey('antenne_id', 'antennes', 'id')
|
|
->create();
|
|
}
|
|
}
|