-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add github action fix add migration try fix elk fix ci fix ci fix ci fix ci fix ci fix ci fix ci fix ci
- Loading branch information
1 parent
4942ec1
commit 37710ef
Showing
6 changed files
with
94 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,26 +18,30 @@ jobs: | |
MYSQL_ROOT_PASSWORD: symfony | ||
MYSQL_DATABASE: symfony | ||
ports: | ||
- 3306/tcp | ||
- 3306:3306 | ||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 --name=mysql | ||
elasticsearch: | ||
image: elasticsearch:8.16.0 | ||
ports: | ||
- 9200/tcp | ||
- 9200:9200 | ||
env: | ||
ELASTIC_PASSWORD: admin | ||
discovery.type: single-node | ||
xpack.security.enabled: true | ||
bootstrap.memory_lock: true | ||
ES_JAVA_OPTS: -Xms512m -Xmx512m | ||
options: --health-cmd="curl http://localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=3 | ||
steps: | ||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: "8.3" | ||
tools: phpunit-bridge | ||
extensions: mbstring, xml, ctype, intl, iconv, json, redis, mysql | ||
extensions: mbstring, xml, ctype, intl, iconv, json, mysql | ||
ini-values: date.timezone=Europe/Paris | ||
- uses: actions/checkout@v4 | ||
- name: Create .env.test.local | ||
# TODO remove LOCK_DSN on Symfony update | ||
run: echo -e "DB_NAME_SUFFIX=\\ELASTICSEARCH_IRI=https://elastic:admin@elasticsearch:${{ job.services.elasticsearch.ports['9200'] }}" > .env.test.local | ||
run: echo -e "DB_NAME_SUFFIX=\\nELASTICSEARCH_IRI=http://elastic:[email protected]:${{ job.services.elasticsearch.ports['9200'] }}" > .env.test.local | ||
- name: Get composer cache directory | ||
id: composer-cache | ||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | ||
|
@@ -49,8 +53,6 @@ jobs: | |
restore-keys: ${{ runner.os }}-composer- | ||
- name: Install Dependencies | ||
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist | ||
- name: Generate SSL Key for JWT | ||
run: php bin/console lexik:jwt:generate-keypair | ||
- name: Run migrations | ||
run: | | ||
php bin/console doctrine:migrations:migrate --no-interaction || echo "No migrations found or migration failed" | ||
|
@@ -69,7 +71,6 @@ jobs: | |
- name: lint:container | ||
if: always() | ||
run: php bin/console lint:container | ||
- name: lint:twig | ||
- name: lint:yaml | ||
if: always() | ||
run: php bin/console lint:yaml config src | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace DoctrineMigrations; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use Doctrine\Migrations\AbstractMigration; | ||
|
||
final class Version20241203150437 extends AbstractMigration | ||
{ | ||
public function up(Schema $schema): void | ||
{ | ||
$this->addSql('ALTER TABLE field ADD CONSTRAINT FK_5BF54558FDA7B0BF FOREIGN KEY (community_id) REFERENCES community (id)'); | ||
$this->addSql('ALTER TABLE field ADD CONSTRAINT FK_5BF5455851D1B0E8 FOREIGN KEY (community_val_id) REFERENCES community (id)'); | ||
$this->addSql('ALTER TABLE field ADD CONSTRAINT FK_5BF5455882D54272 FOREIGN KEY (place_val_id) REFERENCES place (id)'); | ||
$this->addSql('ALTER TABLE field ADD CONSTRAINT FK_5BF545583414710B FOREIGN KEY (agent_id) REFERENCES agent (id)'); | ||
$this->addSql('ALTER TABLE field ADD CONSTRAINT FK_5BF54558DA6A219 FOREIGN KEY (place_id) REFERENCES place (id)'); | ||
} | ||
|
||
public function down(Schema $schema): void | ||
{ | ||
$this->addSql('ALTER TABLE field DROP FOREIGN KEY FK_5BF54558FDA7B0BF'); | ||
$this->addSql('ALTER TABLE field DROP FOREIGN KEY FK_5BF5455851D1B0E8'); | ||
$this->addSql('ALTER TABLE field DROP FOREIGN KEY FK_5BF5455882D54272'); | ||
$this->addSql('ALTER TABLE field DROP FOREIGN KEY FK_5BF545583414710B'); | ||
$this->addSql('ALTER TABLE field DROP FOREIGN KEY FK_5BF54558DA6A219'); | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
src/Core/Infrastructure/Doctrine/FixDoctrineMigrationTableSchema.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Core\Infrastructure\Doctrine; | ||
|
||
use Doctrine\DBAL\Exception; | ||
use Doctrine\DBAL\Schema\SchemaException; | ||
use Doctrine\Migrations\DependencyFactory; | ||
use Doctrine\Migrations\Metadata\Storage\TableMetadataStorageConfiguration; | ||
use Doctrine\ORM\Tools\Event\GenerateSchemaEventArgs; | ||
use Webmozart\Assert\Assert; | ||
|
||
/** @see https://github.com/doctrine/migrations/issues/1406 */ | ||
final class FixDoctrineMigrationTableSchema | ||
{ | ||
private TableMetadataStorageConfiguration $configuration; | ||
|
||
public function __construct( | ||
private readonly DependencyFactory $dependencyFactory, | ||
) { | ||
$configuration = $this->dependencyFactory->getConfiguration()->getMetadataStorageConfiguration(); | ||
|
||
Assert::notNull($configuration); | ||
Assert::isInstanceOf($configuration, TableMetadataStorageConfiguration::class); | ||
|
||
$this->configuration = $configuration; | ||
} | ||
|
||
/** | ||
* @throws SchemaException | ||
* @throws Exception | ||
*/ | ||
public function postGenerateSchema(GenerateSchemaEventArgs $args): void | ||
{ | ||
$schema = $args->getSchema(); | ||
$table = $schema->createTable($this->configuration->getTableName()); | ||
$table->addColumn( | ||
$this->configuration->getVersionColumnName(), | ||
'string', | ||
['notnull' => true, 'length' => $this->configuration->getVersionColumnLength()], | ||
); | ||
$table->addColumn($this->configuration->getExecutedAtColumnName(), 'datetime', ['notnull' => false]); | ||
$table->addColumn($this->configuration->getExecutionTimeColumnName(), 'integer', ['notnull' => false]); | ||
|
||
$table->setPrimaryKey([$this->configuration->getVersionColumnName()]); | ||
} | ||
} |