door card pass: create table and create model and console controller
This commit is contained in:
58
console/migrations/m230126_202055_create_table_door_card_pass.php
Executable file
58
console/migrations/m230126_202055_create_table_door_card_pass.php
Executable file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
use yii\db\Migration;
|
||||
|
||||
/**
|
||||
* Class m230126_202055_create_table_door_card_pass
|
||||
*/
|
||||
class m230126_202055_create_table_door_card_pass 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('door_card_pass',[
|
||||
'id_door_card_pass'=> $this->primaryKey(),
|
||||
'id_card' => $this->integer(11),
|
||||
'id_user' => $this->integer(11),
|
||||
'created_at' => $this->dateTime()->notNull(),
|
||||
'updated_at' => $this->dateTime()->notNull(),
|
||||
],
|
||||
$tableOptions
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeDown()
|
||||
{
|
||||
echo "m230126_202055_create_table_door_card_pass cannot be reverted.\n";
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
// Use up()/down() to run migration code without a transaction.
|
||||
public function up()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
echo "m230126_202055_create_table_door_card_pass cannot be reverted.\n";
|
||||
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
}
|
||||
Reference in New Issue
Block a user