Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed issue #19351: Limesurvey broken after 5.6.50 to 6.4.2 upgrade (#…
…3713) Co-authored-by: Denis Chenu <denis@sondages.pro>
- Loading branch information
Showing
4 changed files
with
28 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
namespace LimeSurvey\Helpers\Update; | ||
|
||
use LimeSurvey\Helpers\Update\DatabaseUpdateBase; | ||
|
||
class Update_623 extends DatabaseUpdateBase | ||
{ | ||
/** | ||
* @inheritDoc | ||
*/ | ||
public function up() | ||
{ | ||
if (\Yii::app()->db->driverName == 'pgsql') { | ||
$table = \Yii::app()->db->schema->getTable('{{users}}'); | ||
if (isset($table->columns['user_status']) && $table->columns['user_status']->dbType != 'integer') { | ||
$this->db->createCommand("ALTER TABLE {{users}} ALTER COLUMN user_status DROP DEFAULT;")->execute(); | ||
$this->db->createCommand("ALTER TABLE {{users}} ALTER COLUMN user_status TYPE INT USING CASE WHEN user_status=TRUE THEN 1 ELSE 0 END;")->execute(); | ||
$this->db->createCommand("ALTER TABLE {{users}} ALTER COLUMN user_status SET DEFAULT 1;")->execute(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters