1 | <?php |
||
15 | class Version20150505142900 extends AbstractMigrationChamilo |
||
16 | { |
||
17 | /** |
||
18 | * @param Schema $schema |
||
19 | * |
||
20 | * @throws \Doctrine\DBAL\Schema\SchemaException |
||
21 | */ |
||
22 | public function up(Schema $schema) |
||
23 | { |
||
24 | // Create table for video chat |
||
25 | if (!$schema->hasTable('chat_video')) { |
||
26 | $chatVideoTable = $schema->createTable('chat_video'); |
||
27 | $chatVideoTable->addColumn( |
||
28 | 'id', |
||
29 | Type::INTEGER, |
||
30 | ['autoincrement' => true, 'notnull' => true] |
||
31 | ); |
||
32 | $chatVideoTable->addColumn( |
||
33 | 'from_user', |
||
34 | Type::INTEGER, |
||
35 | ['notnull' => true] |
||
36 | ); |
||
37 | $chatVideoTable->addColumn( |
||
38 | 'to_user', |
||
39 | Type::INTEGER, |
||
40 | ['notnull' => true] |
||
41 | ); |
||
42 | $chatVideoTable->addColumn( |
||
43 | 'room_name', |
||
44 | Type::STRING, |
||
45 | ['length' => 255, 'notnull' => true] |
||
46 | ); |
||
47 | $chatVideoTable->addColumn( |
||
48 | 'datetime', |
||
49 | Type::DATETIME, |
||
50 | ['notnull' => true] |
||
51 | ); |
||
52 | $chatVideoTable->setPrimaryKey(['id']); |
||
53 | $chatVideoTable->addIndex( |
||
54 | ['from_user'], |
||
55 | 'idx_chat_video_from_user' |
||
56 | ); |
||
57 | $chatVideoTable->addIndex(['to_user'], 'idx_chat_video_to_user'); |
||
58 | $chatVideoTable->addIndex( |
||
59 | ['from_user', 'to_user'], |
||
60 | 'idx_chat_video_users' |
||
61 | ); |
||
62 | $chatVideoTable->addIndex( |
||
63 | ['room_name'], |
||
64 | 'idx_chat_video_room_name' |
||
65 | ); |
||
66 | } |
||
67 | } |
||
68 | |||
69 | /** |
||
70 | * We don't allow downgrades yet |
||
71 | * @param Schema $schema |
||
72 | */ |
||
73 | public function down(Schema $schema) |
||
74 | { |
||
75 | $schema->dropTable('chat_video'); |
||
76 | } |
||
77 | } |
||
78 |