mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-20 17:15:51 +02:00
Added basic fields and migration for MySQL
This commit is contained in:
parent
e7e57fa412
commit
047c82791b
4 changed files with 138 additions and 0 deletions
44
migrations/Version20230402170923.php
Normal file
44
migrations/Version20230402170923.php
Normal file
|
@ -0,0 +1,44 @@
|
|||
<?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 Version20230402170923 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE part_lots ADD id_owner INT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE part_lots ADD CONSTRAINT FK_EBC8F94321E5A74C FOREIGN KEY (id_owner) REFERENCES `users` (id) ON DELETE SET NULL');
|
||||
$this->addSql('CREATE INDEX IDX_EBC8F94321E5A74C ON part_lots (id_owner)');
|
||||
$this->addSql('ALTER TABLE projects ADD CONSTRAINT FK_5C93B3A4727ACA70 FOREIGN KEY (parent_id) REFERENCES projects (id)');
|
||||
$this->addSql('ALTER TABLE storelocations ADD id_owner INT DEFAULT NULL, ADD part_owner_must_match TINYINT(1) NOT NULL');
|
||||
$this->addSql('ALTER TABLE storelocations ADD CONSTRAINT FK_751702021E5A74C FOREIGN KEY (id_owner) REFERENCES `users` (id) ON DELETE SET NULL');
|
||||
$this->addSql('CREATE INDEX IDX_751702021E5A74C ON storelocations (id_owner)');
|
||||
$this->addSql('ALTER TABLE users ADD about_me LONGTEXT DEFAULT \'\' NOT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE log CHANGE level level TINYINT(1) NOT NULL');
|
||||
$this->addSql('ALTER TABLE part_lots DROP FOREIGN KEY FK_EBC8F94321E5A74C');
|
||||
$this->addSql('DROP INDEX IDX_EBC8F94321E5A74C ON part_lots');
|
||||
$this->addSql('ALTER TABLE part_lots DROP id_owner');
|
||||
$this->addSql('ALTER TABLE projects DROP FOREIGN KEY FK_5C93B3A4727ACA70');
|
||||
$this->addSql('ALTER TABLE `storelocations` DROP FOREIGN KEY FK_751702021E5A74C');
|
||||
$this->addSql('DROP INDEX IDX_751702021E5A74C ON `storelocations`');
|
||||
$this->addSql('ALTER TABLE `storelocations` DROP id_owner, DROP part_owner_must_match');
|
||||
$this->addSql('ALTER TABLE `users` DROP about_me');
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue