Merge pull request 'Remove dead code and validate new polls only once' (#33) from chore/remove-dead-code into main
Reviewed-on: #33
This commit was merged in pull request #33.
This commit is contained in:
commit
a62e13eeff
13 files changed
+78
-102
No files matched your search
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Migrations\BaseMigration;
|
||||
|
||||
/**
|
||||
* polls.show_results_to_participants is unused: results belong on the stage, participants
|
||||
* only get them where they interact with them (see PollStateService). There is no switch per poll.
|
||||
*/
|
||||
class DropShowResultsToParticipants extends BaseMigration
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$table = $this->table('polls');
|
||||
if ($table->hasColumn('show_results_to_participants')) {
|
||||
$table->removeColumn('show_results_to_participants')->update();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
$table = $this->table('polls');
|
||||
if (!$table->hasColumn('show_results_to_participants')) {
|
||||
$table->addColumn('show_results_to_participants', 'boolean', [
|
||||
'null' => false,
|
||||
'default' => true,
|
||||
'after' => 'is_active',
|
||||
])->update();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user