add newsletter
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use yii\db\Schema;
|
||||
use yii\db\Migration;
|
||||
|
||||
class m160516_114454_add__customer_newsletter extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$this->addColumn("customer", "newsletter", "int default 1");
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
echo "m160516_114454_add__customer_newsletter cannot be reverted.\n";
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
// Use safeUp/safeDown to run migration code within a transaction
|
||||
public function safeUp()
|
||||
{
|
||||
}
|
||||
|
||||
public function safeDown()
|
||||
{
|
||||
}
|
||||
*/
|
||||
}
|
||||
45
console/migrations/m160516_122708_add_newsletter.php
Normal file
45
console/migrations/m160516_122708_add_newsletter.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use yii\db\Schema;
|
||||
use yii\db\Migration;
|
||||
|
||||
class m160516_122708_add_newsletter 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('{{%newsletter}}', [
|
||||
'id_newsletter' => $this->primaryKey(),
|
||||
'subject' => $this->string(),
|
||||
'body' => $this->text(),
|
||||
'status' => $this->integer(11),
|
||||
'sent' => $this->integer(),
|
||||
'sent_at' => $this->dateTime( ),
|
||||
'created_at' => $this->dateTime()->notNull(),
|
||||
'updated_at' => $this->dateTime()->notNull(),
|
||||
], $tableOptions);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
echo "m160516_122708_add_newsletter cannot be reverted.\n";
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
// Use safeUp/safeDown to run migration code within a transaction
|
||||
public function safeUp()
|
||||
{
|
||||
}
|
||||
|
||||
public function safeDown()
|
||||
{
|
||||
}
|
||||
*/
|
||||
}
|
||||
Reference in New Issue
Block a user