fitness-web/console/migrations/m200103_104020_add_table_fingerprint.php

55 lines
1.3 KiB
PHP

<?php
use yii\db\Migration;
/**
* Class m200103_104020_add_table_fingerprint
*/
class m200103_104020_add_table_fingerprint extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$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('{{%fingerprint}}', [
'id_fingerprint' => $this->primaryKey(),
'id_customer' => $this->integer(11),
'fingerprint' => $this->text(),
'created_at' => $this->dateTime()->notNull(),
'updated_at' => $this->dateTime()->notNull(),
], $tableOptions);
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
echo "m200103_104020_add_table_fingerprint cannot be reverted.\n";
return false;
}
/*
// Use up()/down() to run migration code without a transaction.
public function up()
{
}
public function down()
{
echo "m200103_104020_add_table_fingerprint cannot be reverted.\n";
return false;
}
*/
}