added teacher and option teacher in school
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class ExtendEmployeeForTeachers extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
$this->table('employee')
|
||||
->addColumn('email', 'string', ['limit' => 150, 'null' => true, 'after' => 'surnameemployee'])
|
||||
->addColumn('phone', 'string', ['limit' => 40, 'null' => true, 'after' => 'email'])
|
||||
->addColumn('photo', 'string', ['limit' => 191, 'null' => true, 'after' => 'phone'])
|
||||
->addColumn('is_owner', 'char', [
|
||||
'limit' => 1,
|
||||
'null' => false,
|
||||
'default' => 'N',
|
||||
'comment' => 'Y = titolare della scuola (uno solo)',
|
||||
'after' => 'photo',
|
||||
])
|
||||
->addColumn('notifications', 'char', [
|
||||
'limit' => 1,
|
||||
'null' => false,
|
||||
'default' => 'Y',
|
||||
'comment' => 'Y = riceve le email',
|
||||
'after' => 'is_owner',
|
||||
])
|
||||
->addColumn('active', 'char', ['limit' => 1, 'null' => false, 'default' => 'Y', 'after' => 'notifications'])
|
||||
->addColumn('created_at', 'timestamp', ['null' => true, 'default' => 'CURRENT_TIMESTAMP'])
|
||||
->addColumn('updated_at', 'timestamp', ['null' => true, 'default' => null, 'update' => 'CURRENT_TIMESTAMP'])
|
||||
->update();
|
||||
|
||||
// L'insegnante già presente (id più basso) diventa il titolare
|
||||
$this->execute("UPDATE `employee` SET `is_owner` = 'Y' ORDER BY `idemployee` LIMIT 1");
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
$this->table('employee')
|
||||
->removeColumn('email')
|
||||
->removeColumn('phone')
|
||||
->removeColumn('photo')
|
||||
->removeColumn('is_owner')
|
||||
->removeColumn('notifications')
|
||||
->removeColumn('active')
|
||||
->removeColumn('created_at')
|
||||
->removeColumn('updated_at')
|
||||
->update();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class AddShowTeacherToOption extends AbstractMigration
|
||||
{
|
||||
public function change(): void
|
||||
{
|
||||
$this->table('option')
|
||||
->addColumn('show_teacher', 'char', [
|
||||
'limit' => 1,
|
||||
'null' => false,
|
||||
'default' => 'N',
|
||||
'comment' => 'Y = mostra l\'insegnante nelle card delle classi',
|
||||
'after' => 'waitinglist_enabled',
|
||||
])
|
||||
->update();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user