<?php
/* @noinspection PhpUnused */
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*
* @package API
* @internal
*/
final class Version20220718141904 extends AbstractMigration
{
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE user DROP FOREIGN KEY FK_8D93D6498C03F15C');
$this->addSql('DROP TABLE user');
}
public function getDescription(): string
{
return
"Introduces user table.";
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql(
'
CREATE TABLE user (
id INT AUTO_INCREMENT NOT NULL COMMENT \'Internal ID\',
created INT NOT NULL COMMENT \'Entity creation date as UNIX timestamp\',
username VARCHAR(100) NOT NULL COMMENT \'Unique username (identifier)\',
password VARCHAR(255) NOT NULL COMMENT \'Hashed password\',
email VARCHAR(254) NOT NULL COMMENT \'E-mail address\',
first_name VARCHAR(225) NOT NULL COMMENT \'First name\',
last_name VARCHAR(225) NOT NULL COMMENT \'Last name\',
options JSON DEFAULT NULL COMMENT \'User configuration\',
manual_user SMALLINT DEFAULT 1 NOT NULL COMMENT \'Flag for manually created users\',
new_password_needed SMALLINT DEFAULT 1 NOT NULL COMMENT
\'Flag if user must override his temporary password with a new one\',
last_login INT DEFAULT NULL COMMENT \'Last login date for user as UNIX timestamp\',
active SMALLINT DEFAULT 1 NOT NULL COMMENT \'Indicator if entity is active\',
employee_id INT DEFAULT NULL COMMENT \'Internal ID\',
last_active_date DATE DEFAULT NULL COMMENT \'Last active date\',
UNIQUE INDEX UNIQ_8D93D649F85E0677 (username),
UNIQUE INDEX UNIQ_8D93D6498C03F15C (employee_id),
PRIMARY KEY(id)
) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
'
);
$this->addSql(
'
ALTER TABLE user ADD CONSTRAINT FK_8D93D6498C03F15C FOREIGN KEY
(employee_id) REFERENCES employee (id)
'
);
}
}