Add tag support
This commit is contained in:
parent
ce10245c51
commit
ae440be40c
24 changed files with 475 additions and 15 deletions
37
migrations/Version20260608193439.php
Normal file
37
migrations/Version20260608193439.php
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?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 Version20260608193439 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 TABLE photos_tag (photos_id INT NOT NULL, tag_id INT NOT NULL, PRIMARY KEY (photos_id, tag_id))');
|
||||
$this->addSql('CREATE INDEX IDX_CBE2DE88301EC62 ON photos_tag (photos_id)');
|
||||
$this->addSql('CREATE INDEX IDX_CBE2DE88BAD26311 ON photos_tag (tag_id)');
|
||||
$this->addSql('ALTER TABLE photos_tag ADD CONSTRAINT FK_CBE2DE88301EC62 FOREIGN KEY (photos_id) REFERENCES photos (id) ON DELETE CASCADE');
|
||||
$this->addSql('ALTER TABLE photos_tag ADD CONSTRAINT FK_CBE2DE88BAD26311 FOREIGN KEY (tag_id) REFERENCES tag (id) ON DELETE CASCADE');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE photos_tag DROP CONSTRAINT FK_CBE2DE88301EC62');
|
||||
$this->addSql('ALTER TABLE photos_tag DROP CONSTRAINT FK_CBE2DE88BAD26311');
|
||||
$this->addSql('DROP TABLE photos_tag');
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue