From cfa1d237c5fca35570cdb40cc3f2d058eb3d9a36 Mon Sep 17 00:00:00 2001 From: Roland Schneider Date: Sun, 13 Feb 2022 15:25:25 +0100 Subject: [PATCH] add tables mobile_device & virtual_key --- ...m220213_134539_add_table_mobile_device.php | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 console/migrations/m220213_134539_add_table_mobile_device.php diff --git a/console/migrations/m220213_134539_add_table_mobile_device.php b/console/migrations/m220213_134539_add_table_mobile_device.php new file mode 100644 index 0000000..143b3fb --- /dev/null +++ b/console/migrations/m220213_134539_add_table_mobile_device.php @@ -0,0 +1,68 @@ +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('{{%mobile_device}}', [ + 'id' => $this->primaryKey(), + 'id_card' => $this->integer(11), + 'status' => $this->string(20), + 'device_identifier' => $this->string(255), + 'activated_at' => $this->dateTime(), + 'created_at' => $this->dateTime()->notNull(), + 'updated_at' => $this->dateTime()->notNull(), + ], $tableOptions); + + $this->createTable('{{%virtual_key}}', [ + 'id' => $this->primaryKey(), + 'id_card' => $this->integer(11), + 'id_key' => $this->integer(11), + 'valid_until' => $this->dateTime()->notNull(), + 'direction_in_at' => $this->dateTime(), + 'direction_out_at' => $this->dateTime(), + 'created_at' => $this->dateTime()->notNull(), + 'updated_at' => $this->dateTime()->notNull(), + ], $tableOptions); + + } + + /** + * {@inheritdoc} + */ + public function safeDown() + { + echo "m220213_134539_add_table_mobile_device cannot be reverted.\n"; + + return false; + } + + /* + // Use up()/down() to run migration code without a transaction. + public function up() + { + + } + + public function down() + { + echo "m220213_134539_add_table_mobile_device cannot be reverted.\n"; + + return false; + } + */ +}