@@ -52,26 +52,28 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
5252 /** @var ISchemaWrapper $schema */
5353 $ schema = $ schemaClosure ();
5454
55- $ table = $ schema ->createTable ('storages_credentials ' );
56- $ table ->addColumn ('id ' , Type::BIGINT , [
57- 'autoincrement ' => true ,
58- 'notnull ' => true ,
59- 'length ' => 64 ,
60- ]);
61- $ table ->addColumn ('user ' , Type::STRING , [
62- 'notnull ' => false ,
63- 'length ' => 64 ,
64- ]);
65- $ table ->addColumn ('identifier ' , Type::STRING , [
66- 'notnull ' => true ,
67- 'length ' => 64 ,
68- ]);
69- $ table ->addColumn ('credentials ' , Type::TEXT , [
70- 'notnull ' => false ,
71- ]);
72- $ table ->setPrimaryKey (['id ' ]);
73- $ table ->addUniqueIndex (['user ' , 'identifier ' ], 'stocred_ui ' );
74- $ table ->addIndex (['user ' ], 'stocred_user ' );
55+ if (!$ schema ->hasTable ('storages_credentials ' )) {
56+ $ table = $ schema ->createTable ('storages_credentials ' );
57+ $ table ->addColumn ('id ' , Type::BIGINT , [
58+ 'autoincrement ' => true ,
59+ 'notnull ' => true ,
60+ 'length ' => 64 ,
61+ ]);
62+ $ table ->addColumn ('user ' , Type::STRING , [
63+ 'notnull ' => false ,
64+ 'length ' => 64 ,
65+ ]);
66+ $ table ->addColumn ('identifier ' , Type::STRING , [
67+ 'notnull ' => true ,
68+ 'length ' => 64 ,
69+ ]);
70+ $ table ->addColumn ('credentials ' , Type::TEXT , [
71+ 'notnull ' => false ,
72+ ]);
73+ $ table ->setPrimaryKey (['id ' ]);
74+ $ table ->addUniqueIndex (['user ' , 'identifier ' ], 'stocred_ui ' );
75+ $ table ->addIndex (['user ' ], 'stocred_user ' );
76+ }
7577
7678 return $ schema ;
7779 }
@@ -92,9 +94,9 @@ public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array
9294
9395 $ insert = $ this ->connection ->getQueryBuilder ();
9496 $ insert ->insert ('storages_credentials ' )
95- ->setValue ('user ' , $ insert ->createNamedParameter ('user ' ))
96- ->setValue ('identifier ' , $ insert ->createNamedParameter ('identifier ' ))
97- ->setValue ('credentials ' , $ insert ->createNamedParameter ('credentials ' ));
97+ ->setValue ('user ' , $ insert ->createParameter ('user ' ))
98+ ->setValue ('identifier ' , $ insert ->createParameter ('identifier ' ))
99+ ->setValue ('credentials ' , $ insert ->createParameter ('credentials ' ));
98100
99101 $ result = $ query ->execute ();
100102 while ($ row = $ result ->fetch ()) {
0 commit comments