Skip to content

Commit b5ceb58

Browse files
author
kozhevnikov
committed
migrations
1 parent 783e2dd commit b5ceb58

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
use yii\db\Migration;
4+
use yii\db\Schema;
5+
6+
class m160406_120743_onmotion_yii2_gallery extends Migration
7+
{
8+
public function up()
9+
{
10+
$this->createTable('g_gallery', [
11+
'gallery_id' => Schema::TYPE_PK,
12+
'name' => Schema::TYPE_STRING . '(50) NOT NULL',
13+
'descr' => Schema::TYPE_TEXT,
14+
'date' => Schema::TYPE_DATETIME,
15+
]);
16+
$this->createTable('g_photo', [
17+
'photo_id' => Schema::TYPE_PK,
18+
'gallery_id' => Schema::TYPE_INTEGER . ' NOT NULL',
19+
'name' => Schema::TYPE_STRING . '(255) NOT NULL',
20+
]);
21+
}
22+
23+
public function down()
24+
{
25+
$this->dropTable('g_gallery');
26+
$this->dropTable('g_photo');
27+
}
28+
29+
}

0 commit comments

Comments
 (0)