@@ -44,44 +44,45 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
4444 /** @var ISchemaWrapper $schema */
4545 $ schema = $ schemaClosure ();
4646
47- if ($ schema ->hasTable ('talk_attendees ' )) {
48- $ table = $ schema ->getTable ('talk_attendees ' );
49- if (!$ table ->hasColumn ('access_token ' )) {
50- $ table ->addColumn ('access_token ' , Types::STRING , [
51- 'notnull ' => false ,
52- 'default ' => null ,
53- ]);
54- }
47+ $ table = $ schema ->getTable ('talk_attendees ' );
48+ if (!$ table ->hasColumn ('access_token ' )) {
49+ $ table ->addColumn ('access_token ' , Types::STRING , [
50+ 'notnull ' => false ,
51+ 'default ' => null ,
52+ ]);
5553 }
5654
57- if ($ schema ->hasTable ('talk_rooms ' )) {
58- $ table = $ schema ->getTable ('talk_rooms ' );
59- if (!$ table ->hasColumn ('server_url ' )) {
60- $ table ->addColumn ('server_url ' , Types::STRING , [
61- 'notnull ' => false ,
62- 'default ' => null ,
63- ]);
64- }
55+ $ table = $ schema ->getTable ('talk_rooms ' );
56+ if (!$ table ->hasColumn ('server_url ' )) {
57+ $ table ->addColumn ('server_url ' , Types::STRING , [
58+ 'notnull ' => false ,
59+ 'default ' => null ,
60+ ]);
6561 }
6662
67- $ table = $ schema ->createTable ('talk_invitations ' );
68- $ table ->addColumn ('id ' , Types::BIGINT , [
69- 'autoincrement ' => true ,
70- 'notnull ' => true ,
71- ]);
72- $ table ->addColumn ('room_id ' , Types::BIGINT , [
73- 'notnull ' => true ,
74- 'unsigned ' => true ,
75- ]);
76- $ table ->addColumn ('user_id ' , Types::STRING , [
77- 'notnull ' => true ,
78- 'length ' => 255 ,
79- ]);
80- $ table ->addColumn ('access_token ' , Types::STRING , [
81- 'notnull ' => true ,
82- ]);
63+ if (!$ schema ->hasTable ('talk_invitations ' )) {
64+ $ table = $ schema ->createTable ('talk_invitations ' );
65+ $ table ->addColumn ('id ' , Types::BIGINT , [
66+ 'autoincrement ' => true ,
67+ 'notnull ' => true ,
68+ ]);
69+ $ table ->addColumn ('room_id ' , Types::BIGINT , [
70+ 'notnull ' => true ,
71+ 'unsigned ' => true ,
72+ ]);
73+ $ table ->addColumn ('user_id ' , Types::STRING , [
74+ 'notnull ' => true ,
75+ 'length ' => 255 ,
76+ ]);
77+ $ table ->addColumn ('access_token ' , Types::STRING , [
78+ 'notnull ' => true ,
79+ ]);
80+
81+ $ table ->setPrimaryKey (['id ' ]);
82+
83+ $ table ->addIndex (['room_id ' ]);
84+ }
8385
84- $ table ->setPrimaryKey (['id ' ]);
8586
8687 return $ schema ;
8788 }
0 commit comments