Skip to content

Commit

Permalink
Test ID
Browse files Browse the repository at this point in the history
  • Loading branch information
ili101 committed Jul 8, 2024
1 parent ab61e6a commit c19da41
Show file tree
Hide file tree
Showing 12 changed files with 748 additions and 2 deletions.
3 changes: 2 additions & 1 deletion api/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
"symfony/phpunit-bridge": "6.4.*",
"symfony/stopwatch": "6.4.*",
"symfony/var-dumper": "6.4.*",
"symfony/web-profiler-bundle": "6.4.*"
"symfony/web-profiler-bundle": "6.4.*",
"zenstruck/foundry": "^2.0"
},
"config": {
"optimize-autoloader": true,
Expand Down
220 changes: 219 additions & 1 deletion api/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions api/config/bundles.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true],
Zenstruck\Foundry\ZenstruckFoundryBundle::class => ['dev' => true, 'test' => true],
];
2 changes: 2 additions & 0 deletions api/config/packages/api_platform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ api_platform:
extra_properties:
standard_put: true
rfc_7807_compliant_errors: true
denormalization_context:
allow_extra_attributes: false
# change this to true if you use controllers
use_symfony_listeners: false
keep_legacy_inflector: false
7 changes: 7 additions & 0 deletions api/config/packages/zenstruck_foundry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
when@dev: &dev
# See full configuration: https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#full-default-bundle-configuration
zenstruck_foundry:
# Whether to auto-refresh proxies by default (https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#auto-refresh)
auto_refresh_proxies: true

when@test: *dev
47 changes: 47 additions & 0 deletions api/migrations/Version20240708230111.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?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 Version20240708230111 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 SEQUENCE main_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE sub_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE main (id INT NOT NULL, sub1_id INT DEFAULT NULL, sub2_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_BF28CD6429662E71 ON main (sub1_id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_BF28CD643BD3819F ON main (sub2_id)');
$this->addSql('CREATE TABLE sub (id INT NOT NULL, main_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_580282DC627EA78A ON sub (main_id)');
$this->addSql('ALTER TABLE main ADD CONSTRAINT FK_BF28CD6429662E71 FOREIGN KEY (sub1_id) REFERENCES sub (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE main ADD CONSTRAINT FK_BF28CD643BD3819F FOREIGN KEY (sub2_id) REFERENCES sub (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE sub ADD CONSTRAINT FK_580282DC627EA78A FOREIGN KEY (main_id) REFERENCES main (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
}

public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('DROP SEQUENCE main_id_seq CASCADE');
$this->addSql('DROP SEQUENCE sub_id_seq CASCADE');
$this->addSql('ALTER TABLE main DROP CONSTRAINT FK_BF28CD6429662E71');
$this->addSql('ALTER TABLE main DROP CONSTRAINT FK_BF28CD643BD3819F');
$this->addSql('ALTER TABLE sub DROP CONSTRAINT FK_580282DC627EA78A');
$this->addSql('DROP TABLE main');
$this->addSql('DROP TABLE sub');
}
}
Loading

0 comments on commit c19da41

Please sign in to comment.