add fingerpint rest
This commit is contained in:
54
console/migrations/m200103_104020_add_table_fingerprint.php
Normal file
54
console/migrations/m200103_104020_add_table_fingerprint.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?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;
|
||||
}
|
||||
*/
|
||||
}
|
||||
52
console/migrations/m200106_093107_add_user_fingerprint.php
Normal file
52
console/migrations/m200106_093107_add_user_fingerprint.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
use common\models\User;
|
||||
use yii\db\Migration;
|
||||
|
||||
/**
|
||||
* Class m200106_093107_add_user_fingerprint
|
||||
*/
|
||||
class m200106_093107_add_user_fingerprint extends Migration
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeUp()
|
||||
{
|
||||
$user = new User();
|
||||
$user->username = 'fingerprint_system';
|
||||
$user->email = 'fingerprint_system@rocho-net.hu';
|
||||
$user->setPassword('Vn?y0c?DI|Ar6Kfvmf?$');
|
||||
$user->generateAuthKey();
|
||||
$user->save();
|
||||
|
||||
$role = Yii::$app->authManager->createRole('fingerprint_system');
|
||||
Yii::$app->authManager->add($role);
|
||||
Yii::$app->authManager->assign($role, $user->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeDown()
|
||||
{
|
||||
echo "m200106_093107_add_user_fingerprint cannot be reverted.\n";
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
// Use up()/down() to run migration code without a transaction.
|
||||
public function up()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
echo "m200106_093107_add_user_fingerprint cannot be reverted.\n";
|
||||
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
}
|
||||
Reference in New Issue
Block a user