@@ -40,61 +40,62 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con
4040 $ installer = $ setup ;
4141 $ installer ->startSetup ();
4242 $ table = $ installer ->getTable ('lof_chatsystem_chat ' );
43+ if (version_compare ($ context ->getVersion (), '1.0.3 ' , '< ' )) {
44+ $ installer ->getConnection ()->addColumn (
45+ $ table ,
46+ 'ip ' ,
47+ [
48+ 'type ' => \Magento \Framework \DB \Ddl \Table::TYPE_TEXT ,
49+ 'length ' => 255 ,
50+ 'nullable ' => true ,
51+ 'comment ' => 'Ip '
52+ ]
53+ );
4354
44- $ installer ->getConnection ()->addColumn (
45- $ table ,
46- 'ip ' ,
47- [
48- 'type ' => \Magento \Framework \DB \Ddl \Table::TYPE_TEXT ,
49- 'length ' => 255 ,
50- 'nullable ' => true ,
51- 'comment ' => 'Ip '
52- ]
53- );
54-
55- $ installer ->getConnection ()->addColumn (
56- $ table ,
57- 'current_url ' ,
58- [
59- 'type ' => \Magento \Framework \DB \Ddl \Table::TYPE_TEXT ,
60- 'length ' => 255 ,
61- 'nullable ' => true ,
62- 'comment ' => 'Current Url '
63- ]
64- );
55+ $ installer ->getConnection ()->addColumn (
56+ $ table ,
57+ 'current_url ' ,
58+ [
59+ 'type ' => \Magento \Framework \DB \Ddl \Table::TYPE_TEXT ,
60+ 'length ' => 255 ,
61+ 'nullable ' => true ,
62+ 'comment ' => 'Current Url '
63+ ]
64+ );
6565
66- $ installer ->getConnection ()->addColumn (
67- $ table ,
68- 'number_message ' ,
66+ $ installer ->getConnection ()->addColumn (
67+ $ table ,
68+ 'number_message ' ,
69+ [
70+ 'type ' => \Magento \Framework \DB \Ddl \Table::TYPE_INTEGER ,
71+ 'length ' => 11 ,
72+ 'nullable ' => true ,
73+ 'comment ' => 'Number Message '
74+ ]
75+ );
76+ $ installer ->getConnection ()->addColumn (
77+ $ table ,
78+ 'status ' ,
79+ [
80+ 'type ' => \Magento \Framework \DB \Ddl \Table::TYPE_SMALLINT ,
81+ 'unsigned ' => true ,
82+ 'nullable ' => false ,
83+ 'default ' => '1 ' ,
84+ 'comment ' => 'Status '
85+ ]
86+ );
87+ $ installer ->getConnection ()->addColumn (
88+ $ table ,
89+ 'answered ' ,
6990 [
70- 'type ' => \Magento \Framework \DB \Ddl \Table::TYPE_INTEGER ,
71- 'length ' => 11 ,
72- 'nullable ' => true ,
73- 'comment ' => 'Number Message '
74- ]
75- );
76- $ installer ->getConnection ()->addColumn (
77- $ table ,
78- 'status ' ,
79- [
80- 'type ' => \Magento \Framework \DB \Ddl \Table::TYPE_SMALLINT ,
81- 'unsigned ' => true ,
82- 'nullable ' => false ,
83- 'default ' => '1 ' ,
84- 'comment ' => 'Status '
85- ]
86- );
87- $ installer ->getConnection ()->addColumn (
88- $ table ,
89- 'answered ' ,
90- [
91- 'type ' => \Magento \Framework \DB \Ddl \Table::TYPE_SMALLINT ,
92- 'unsigned ' => true ,
93- 'nullable ' => false ,
94- 'default ' => '1 ' ,
95- 'comment ' => 'Answered '
96- ]
97- );
91+ 'type ' => \Magento \Framework \DB \Ddl \Table::TYPE_SMALLINT ,
92+ 'unsigned ' => true ,
93+ 'nullable ' => false ,
94+ 'default ' => '1 ' ,
95+ 'comment ' => 'Answered '
96+ ]
97+ );
98+ }
9899
99100 //Update for version 1.0.4
100101 if (version_compare ($ context ->getVersion (), '1.0.4 ' , '< ' )) {
@@ -156,6 +157,66 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con
156157 );
157158 $ installer ->getConnection ()->createTable ($ table );
158159 }
160+ //Update for version 1.0.5
161+ if (version_compare ($ context ->getVersion (), '1.0.5 ' , '< ' )) {
162+ $ table = $ installer ->getTable ('lof_chatsystem_chat ' );
163+
164+ $ installer ->getConnection ()->addColumn (
165+ $ table ,
166+ 'user_agent ' ,
167+ [
168+ 'type ' => \Magento \Framework \DB \Ddl \Table::TYPE_TEXT ,
169+ 'length ' => 255 ,
170+ 'nullable ' => true ,
171+ 'comment ' => 'User Agent '
172+ ]
173+ );
174+
175+ $ installer ->getConnection ()->addColumn (
176+ $ table ,
177+ 'browser ' ,
178+ [
179+ 'type ' => \Magento \Framework \DB \Ddl \Table::TYPE_TEXT ,
180+ 'length ' => 100 ,
181+ 'nullable ' => true ,
182+ 'comment ' => 'Browser Info '
183+ ]
184+ );
185+
186+ $ installer ->getConnection ()->addColumn (
187+ $ table ,
188+ 'os ' ,
189+ [
190+ 'type ' => \Magento \Framework \DB \Ddl \Table::TYPE_TEXT ,
191+ 'length ' => 255 ,
192+ 'nullable ' => true ,
193+ 'comment ' => 'Os Info '
194+ ]
195+ );
196+
197+ $ installer ->getConnection ()->addColumn (
198+ $ table ,
199+ 'country ' ,
200+ [
201+ 'type ' => \Magento \Framework \DB \Ddl \Table::TYPE_TEXT ,
202+ 'length ' => 50 ,
203+ 'nullable ' => true ,
204+ 'comment ' => 'Country Info '
205+ ]
206+ );
207+
208+ $ installer ->getConnection ()->addColumn (
209+ $ table ,
210+ 'phone_number ' ,
211+ [
212+ 'type ' => \Magento \Framework \DB \Ddl \Table::TYPE_TEXT ,
213+ 'length ' => 50 ,
214+ 'nullable ' => true ,
215+ 'comment ' => 'Phone Number Info '
216+ ]
217+ );
218+
219+ }
159220 $ installer ->endSetup ();
160221 }
161222}
0 commit comments