mirror of
https://github.com/janickiy/yii2-nomer
synced 2025-03-09 15:39:59 +00:00
add files to project
This commit is contained in:
commit
5cac498444
3729 changed files with 836998 additions and 0 deletions
49
migrations/m170605_102413_create_telegrams_table.php
Normal file
49
migrations/m170605_102413_create_telegrams_table.php
Normal file
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
use yii\db\Migration;
|
||||
|
||||
/**
|
||||
* Handles the creation of table `telegrams`.
|
||||
*/
|
||||
class m170605_102413_create_telegrams_table extends Migration
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
$this->createTable('telegrams', [
|
||||
'id' => $this->primaryKey(),
|
||||
'host' => $this->string(),
|
||||
'port' => $this->smallInteger(),
|
||||
'status' => $this->smallInteger()->defaultValue(1),
|
||||
'tm_last' => $this->timestamp()
|
||||
]);
|
||||
|
||||
$instances = [
|
||||
'127.0.0.1:1236',
|
||||
'5.104.111.8:1236',
|
||||
'46.4.69.117:1236',
|
||||
'46.4.202.77:1236',
|
||||
'46.4.202.75:1236',
|
||||
'46.4.202.78:1236',
|
||||
];
|
||||
|
||||
foreach ($instances as $instance) {
|
||||
list($host, $port) = explode(':', $instance);
|
||||
|
||||
$this->insert('telegrams', [
|
||||
'host' => $host,
|
||||
'port' => $port
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
$this->dropTable('telegrams');
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue