Auto increment change
This commit is contained in:
parent
675245d1e0
commit
2eb2ea81f3
3 changed files with 6 additions and 6 deletions
|
|
@ -20,8 +20,8 @@ final class Version20260522200819 extends AbstractMigration
|
||||||
public function up(Schema $schema): void
|
public function up(Schema $schema): void
|
||||||
{
|
{
|
||||||
// this up() migration is auto-generated, please modify it to your needs
|
// this up() migration is auto-generated, please modify it to your needs
|
||||||
$this->addSql('CREATE TABLE page (id INT GENERATED BY DEFAULT AS IDENTITY, title VARCHAR(255), text TEXT, url VARCHAR(255), PRIMARY KEY (id))');
|
$this->addSql('CREATE TABLE page (id INT AUTO_INCREMENT, title VARCHAR(255), text TEXT, url VARCHAR(255), PRIMARY KEY (id))');
|
||||||
$this->addSql('CREATE TABLE post (id INT GENERATED BY DEFAULT AS IDENTITY, title VARCHAR(255), date TIMESTAMP(0) WITHOUT TIME ZONE , text TEXT, url VARCHAR(255), PRIMARY KEY (id))');
|
$this->addSql('CREATE TABLE post (id INT AUTO_INCREMENT, title VARCHAR(255), date TIMESTAMP(0) WITHOUT TIME ZONE , text TEXT, url VARCHAR(255), PRIMARY KEY (id))');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function down(Schema $schema): void
|
public function down(Schema $schema): void
|
||||||
|
|
|
||||||
|
|
@ -20,11 +20,11 @@ final class Version20260522205620 extends AbstractMigration
|
||||||
public function up(Schema $schema): void
|
public function up(Schema $schema): void
|
||||||
{
|
{
|
||||||
// this up() migration is auto-generated, please modify it to your needs
|
// this up() migration is auto-generated, please modify it to your needs
|
||||||
$this->addSql('CREATE TABLE category (id INT GENERATED BY DEFAULT AS IDENTITY, title VARCHAR(255), PRIMARY KEY (id))');
|
$this->addSql('CREATE TABLE category (id INT AUTO_INCREMENT, title VARCHAR(255), PRIMARY KEY (id))');
|
||||||
$this->addSql('CREATE TABLE post_tag (post_id INT, tag_id INT, PRIMARY KEY (post_id, tag_id))');
|
$this->addSql('CREATE TABLE post_tag (post_id INT, tag_id INT, PRIMARY KEY (post_id, tag_id))');
|
||||||
$this->addSql('CREATE INDEX IDX_5ACE3AF04B89032C ON post_tag (post_id)');
|
$this->addSql('CREATE INDEX IDX_5ACE3AF04B89032C ON post_tag (post_id)');
|
||||||
$this->addSql('CREATE INDEX IDX_5ACE3AF0BAD26311 ON post_tag (tag_id)');
|
$this->addSql('CREATE INDEX IDX_5ACE3AF0BAD26311 ON post_tag (tag_id)');
|
||||||
$this->addSql('CREATE TABLE tag (id INT GENERATED BY DEFAULT AS IDENTITY, title VARCHAR(255), PRIMARY KEY (id))');
|
$this->addSql('CREATE TABLE tag (id INT AUTO_INCREMENT, title VARCHAR(255), PRIMARY KEY (id))');
|
||||||
$this->addSql('ALTER TABLE post_tag ADD CONSTRAINT FK_5ACE3AF04B89032C FOREIGN KEY (post_id) REFERENCES post (id) ON DELETE CASCADE');
|
$this->addSql('ALTER TABLE post_tag ADD CONSTRAINT FK_5ACE3AF04B89032C FOREIGN KEY (post_id) REFERENCES post (id) ON DELETE CASCADE');
|
||||||
$this->addSql('ALTER TABLE post_tag ADD CONSTRAINT FK_5ACE3AF0BAD26311 FOREIGN KEY (tag_id) REFERENCES tag (id) ON DELETE CASCADE');
|
$this->addSql('ALTER TABLE post_tag ADD CONSTRAINT FK_5ACE3AF0BAD26311 FOREIGN KEY (tag_id) REFERENCES tag (id) ON DELETE CASCADE');
|
||||||
$this->addSql('ALTER TABLE post ADD category_id INT DEFAULT NULL');
|
$this->addSql('ALTER TABLE post ADD category_id INT DEFAULT NULL');
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,9 @@ final class Version20260601003707 extends AbstractMigration
|
||||||
public function up(Schema $schema): void
|
public function up(Schema $schema): void
|
||||||
{
|
{
|
||||||
// this up() migration is auto-generated, please modify it to your needs
|
// this up() migration is auto-generated, please modify it to your needs
|
||||||
$this->addSql('CREATE TABLE photo (id INT GENERATED BY DEFAULT AS IDENTITY, file VARCHAR(255), equipment VARCHAR(255), location VARCHAR(255), caption VARCHAR(255), date DATE, photos_id INT DEFAULT NULL, PRIMARY KEY (id))');
|
$this->addSql('CREATE TABLE photo (id INT AUTO_INCREMENT, file VARCHAR(255), equipment VARCHAR(255), location VARCHAR(255), caption VARCHAR(255), date DATE, photos_id INT DEFAULT NULL, PRIMARY KEY (id))');
|
||||||
$this->addSql('CREATE INDEX IDX_14B78418301EC62 ON photo (photos_id)');
|
$this->addSql('CREATE INDEX IDX_14B78418301EC62 ON photo (photos_id)');
|
||||||
$this->addSql('CREATE TABLE photos (id INT GENERATED BY DEFAULT AS IDENTITY, title VARCHAR(255), date TIMESTAMP(0) WITHOUT TIME ZONE, category_id INT DEFAULT NULL, PRIMARY KEY (id))');
|
$this->addSql('CREATE TABLE photos (id INT AUTO_INCREMENT, title VARCHAR(255), date TIMESTAMP(0) WITHOUT TIME ZONE, category_id INT DEFAULT NULL, PRIMARY KEY (id))');
|
||||||
$this->addSql('CREATE INDEX IDX_876E0D912469DE2 ON photos (category_id)');
|
$this->addSql('CREATE INDEX IDX_876E0D912469DE2 ON photos (category_id)');
|
||||||
$this->addSql('ALTER TABLE photo ADD CONSTRAINT FK_14B78418301EC62 FOREIGN KEY (photos_id) REFERENCES photos (id)');
|
$this->addSql('ALTER TABLE photo ADD CONSTRAINT FK_14B78418301EC62 FOREIGN KEY (photos_id) REFERENCES photos (id)');
|
||||||
$this->addSql('ALTER TABLE photos ADD CONSTRAINT FK_876E0D912469DE2 FOREIGN KEY (category_id) REFERENCES category (id)');
|
$this->addSql('ALTER TABLE photos ADD CONSTRAINT FK_876E0D912469DE2 FOREIGN KEY (category_id) REFERENCES category (id)');
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue