42 lines
2.5 KiB
PHP
42 lines
2.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace DoctrineMigrations;
|
|
|
|
use Doctrine\DBAL\Schema\Schema;
|
|
use Doctrine\Migrations\AbstractMigration;
|
|
|
|
/**
|
|
* Auto-generated Migration: Please modify to your needs!
|
|
*/
|
|
final class Version20241206014353 extends AbstractMigration
|
|
{
|
|
public function getDescription(): string
|
|
{
|
|
return '';
|
|
}
|
|
|
|
public function up(Schema $schema): void
|
|
{
|
|
// this up() migration is auto-generated, please modify it to your needs
|
|
$this->addSql('CREATE TEMPORARY TABLE __temp__mydevel_webroot_file AS SELECT id, owner_id, url, abspath, description FROM mydevel_webroot_file');
|
|
$this->addSql('DROP TABLE mydevel_webroot_file');
|
|
$this->addSql('CREATE TABLE mydevel_webroot_file (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, owner_id INTEGER NOT NULL, url_path CLOB NOT NULL, abspath CLOB NOT NULL, description CLOB DEFAULT NULL, section VARCHAR(1024) DEFAULT \'webroot\' NOT NULL, CONSTRAINT FK_A7B135127E3C61F9 FOREIGN KEY (owner_id) REFERENCES mydevel_webroot_user (id) ON UPDATE NO ACTION ON DELETE NO ACTION NOT DEFERRABLE INITIALLY IMMEDIATE)');
|
|
$this->addSql('INSERT INTO mydevel_webroot_file (id, owner_id, url_path, abspath, description) SELECT id, owner_id, url, abspath, description FROM __temp__mydevel_webroot_file');
|
|
$this->addSql('DROP TABLE __temp__mydevel_webroot_file');
|
|
$this->addSql('CREATE UNIQUE INDEX UNIQ_A7B135127E3C61F9 ON mydevel_webroot_file (owner_id)');
|
|
}
|
|
|
|
public function down(Schema $schema): void
|
|
{
|
|
// this down() migration is auto-generated, please modify it to your needs
|
|
$this->addSql('CREATE TEMPORARY TABLE __temp__mydevel_webroot_file AS SELECT id, owner_id, url_path, abspath, description FROM mydevel_webroot_file');
|
|
$this->addSql('DROP TABLE mydevel_webroot_file');
|
|
$this->addSql('CREATE TABLE mydevel_webroot_file (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, owner_id INTEGER NOT NULL, url CLOB NOT NULL, abspath CLOB NOT NULL, description CLOB DEFAULT NULL, CONSTRAINT FK_A7B135127E3C61F9 FOREIGN KEY (owner_id) REFERENCES mydevel_webroot_user (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
|
|
$this->addSql('INSERT INTO mydevel_webroot_file (id, owner_id, url, abspath, description) SELECT id, owner_id, url_path, abspath, description FROM __temp__mydevel_webroot_file');
|
|
$this->addSql('DROP TABLE __temp__mydevel_webroot_file');
|
|
$this->addSql('CREATE UNIQUE INDEX UNIQ_A7B135127E3C61F9 ON mydevel_webroot_file (owner_id)');
|
|
}
|
|
}
|