2020-03-11 21:48:47 +01:00
< ? php
declare ( strict_types = 1 );
namespace DoctrineMigrations ;
2020-07-04 23:38:18 +02:00
use App\Migration\AbstractMultiPlatformMigration ;
2020-03-11 21:48:47 +01:00
use Doctrine\DBAL\Schema\Schema ;
/**
* Auto - generated Migration : Please modify to your needs !
*/
2020-06-13 23:58:59 +02:00
final class Version20200311204104 extends AbstractMultiPlatformMigration
2020-03-11 21:48:47 +01:00
{
2020-03-15 13:56:31 +01:00
public function getDescription () : string
2020-03-11 21:48:47 +01:00
{
return '' ;
}
2020-06-13 23:58:59 +02:00
public function mySQLUp ( Schema $schema ) : void
2020-03-11 21:48:47 +01:00
{
// this up() migration is auto-generated, please modify it to your needs
2022-03-04 18:51:58 +01:00
$this -> abortIf ( 'mysql' !== $this -> getDatabaseType (), 'Migration can only be executed safely on \'mysql\'.' );
2020-03-11 21:48:47 +01:00
2020-03-14 22:12:19 +01:00
$this -> addSql ( 'CREATE TABLE parameters (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, symbol VARCHAR(255) NOT NULL, value_min DOUBLE PRECISION DEFAULT NULL, value_typical DOUBLE PRECISION DEFAULT NULL, value_max DOUBLE PRECISION DEFAULT NULL, unit VARCHAR(255) NOT NULL, value_text VARCHAR(255) NOT NULL, param_group VARCHAR(255) NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, type SMALLINT NOT NULL, element_id INT NOT NULL, INDEX IDX_69348FE1F1F2A24 (element_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB' );
2020-03-26 13:09:25 +01:00
$this -> addSql ( 'ALTER TABLE `groups` ADD perms_parts_parameters SMALLINT NOT NULL' );
$this -> addSql ( 'ALTER TABLE `users` ADD perms_parts_parameters SMALLINT NOT NULL' );
2020-03-11 21:48:47 +01:00
$this -> addSql ( 'ALTER TABLE log CHANGE level level TINYINT' );
2020-03-26 13:09:25 +01:00
2020-03-29 22:16:06 +02:00
$sql = 'UPDATE `groups`' .
2020-03-26 13:09:25 +01:00
'SET perms_parts_parameters = 341 WHERE (id = 1 AND name = "admins") OR (id = 3 AND name = "users");' ;
$this -> addSql ( $sql );
2020-03-29 22:16:06 +02:00
$sql = 'UPDATE `groups`' .
2020-03-26 13:09:25 +01:00
'SET perms_parts_parameters = 681 WHERE (id = 2 AND name = "readonly");' ;
$this -> addSql ( $sql );
2020-03-11 21:48:47 +01:00
}
2020-06-13 23:58:59 +02:00
public function mySQLDown ( Schema $schema ) : void
2020-03-11 21:48:47 +01:00
{
// this down() migration is auto-generated, please modify it to your needs
2022-03-04 18:51:58 +01:00
$this -> abortIf ( 'mysql' !== $this -> getDatabaseType (), 'Migration can only be executed safely on \'mysql\'.' );
2020-03-11 21:48:47 +01:00
$this -> addSql ( 'DROP TABLE parameters' );
2020-03-26 13:09:25 +01:00
$this -> addSql ( 'ALTER TABLE `groups` DROP perms_parts_parameters' );
$this -> addSql ( 'ALTER TABLE `users` DROP perms_parts_parameters' );
2020-03-11 21:48:47 +01:00
$this -> addSql ( 'ALTER TABLE log CHANGE level level TINYINT(1) DEFAULT NULL' );
}
2020-06-13 23:58:59 +02:00
public function sqLiteUp ( Schema $schema ) : void
{
2020-07-04 23:38:18 +02:00
$this -> warnIf ( true , " Migration not needed for SQLite. Skipping... " );
2020-06-13 23:58:59 +02:00
}
public function sqLiteDown ( Schema $schema ) : void
{
2020-07-04 23:38:18 +02:00
$this -> warnIf ( true , " Migration not needed for SQLite. Skipping... " );
2020-06-13 23:58:59 +02:00
}
2020-03-11 21:48:47 +01:00
}