File tree Expand file tree Collapse file tree 2 files changed +17
-8
lines changed
Expand file tree Collapse file tree 2 files changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -463,15 +463,24 @@ public function fixNullishShares(): array {
463463 $ messages = [];
464464 $ query = $ this ->connection ->getQueryBuilder ();
465465
466- // replace all nullish group_ids with 0 in share table
467- $ query -> update ( Share::TABLE )
468- -> set ( ' group_id ' , $ query -> createNamedParameter ( 0 , IQueryBuilder:: PARAM_INT ))
469- -> where ( $ query -> expr ()-> isNull ( ' group_id ' ));
466+ if (! $ this -> schema -> hasTable (Share:: TABLE )) {
467+ $ messages [] = ' Table ' . Share::TABLE . ' does not exist ' ;
468+ return $ messages ;
469+ }
470470
471- $ count = $ query -> executeStatement ( );
471+ $ table = $ this -> schema -> getTable (Share:: TABLE );
472472
473- if ($ count > 0 ) {
474- $ messages [] = 'Updated ' . $ count . ' shares and set group_id to 0 for nullish values ' ;
473+ if ($ table ->hasColumn ('group_id ' )) {
474+ // replace all nullish group_ids with 0 in share table
475+ $ query ->update (Share::TABLE )
476+ ->set ('group_id ' , $ query ->createNamedParameter (0 , IQueryBuilder::PARAM_INT ))
477+ ->where ($ query ->expr ()->isNull ('group_id ' ));
478+
479+ $ count = $ query ->executeStatement ();
480+
481+ if ($ count > 0 ) {
482+ $ messages [] = 'Updated ' . $ count . ' shares and set group_id to 0 for nullish values ' ;
483+ }
475484 }
476485
477486 // replace all nullish poll_id with 0 in share table
Original file line number Diff line number Diff line change 2424 *
2525 * @psalm-suppress UnusedClass
2626 */
27- class Version080300Date20250816201201 extends SimpleMigrationStep {
27+ class Version080301Date20250822153002 extends SimpleMigrationStep {
2828 private ISchemaWrapper $ schema ;
2929 private ?IOutput $ output = null ;
3030
You can’t perform that action at this time.
0 commit comments