add Image and Upload helper classes

This commit is contained in:
2015-11-29 08:28:09 +01:00
parent 40509961cd
commit ed80f8720d
10 changed files with 501 additions and 25 deletions

View File

@@ -0,0 +1,43 @@
<?php
use yii\db\Schema;
use yii\db\Migration;
class m151127_152631_add__table__image 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('{{%image}}', [
'id_image' => $this->primaryKey(),
'path' => $this->string(255),
'created_at' => $this->dateTime()->notNull(),
'updated_at' => $this->dateTime()->notNull(),
], $tableOptions);
}
public function down()
{
echo "m151127_152631_add__table__image cannot be reverted.\n";
return false;
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}

View File

@@ -0,0 +1,30 @@
<?php
use yii\db\Schema;
use yii\db\Migration;
class m151127_214503_alter__table__customer__add__column__id_image extends Migration
{
public function up()
{
$this->addColumn("customer", "id_image", "int");
}
public function down()
{
echo "m151127_214503_alter__table__customer__add__column__id_image cannot be reverted.\n";
return false;
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}