fitness-web/console/migrations/m150925_194508_add__table__customer.php

49 lines
1.5 KiB
PHP

<?php
use yii\db\Schema;
use yii\db\Migration;
class m150925_194508_add__table__customer extends Migration
{
public function up()
{
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
}
$this->createTable('{{%customer}}', [
'id_customer' => $this->primaryKey(),
'id_customer_card' => $this->integer(),
'id_user' => $this->integer(),
'id_partner_card' => $this->integer(),
'id_proposer' =>$this->integer(),
'name' => $this->string(128),
'email' => $this->string(255),
'password' => $this->string(32),
'phone' => $this->string(20),
'sex' => $this->smallInteger(),
'date_stundent_card_expire' => $this->date(),
'birthdate' => $this->date(),
'image' => $this->string(255),
'description' => $this->string(255),
'tax_number' => $this->string(20),
'country' => $this->string(20),
'zip' => $this->string(8),
'city' => $this->string(30),
'address' => $this->string(255),
'created_at' => $this->timestamp()->notNull(),
'updated_at' => $this->timestamp()->notNull(),
], $tableOptions);
}
public function down()
{
echo "m150925_194508_add__table__customer cannot be reverted.\n";
return false;
}
}