From 8a2327a3f052b1778230626eb8122a55fa908709 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Baillet?= Date: Tue, 3 Dec 2024 16:06:55 +0100 Subject: [PATCH] add migration --- .github/workflows/github-actions.yml | 2 -- compose.yaml | 1 - migrations/Version20241203150437.php | 29 ++++++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 migrations/Version20241203150437.php diff --git a/.github/workflows/github-actions.yml b/.github/workflows/github-actions.yml index f7f0ef5..a77ed70 100644 --- a/.github/workflows/github-actions.yml +++ b/.github/workflows/github-actions.yml @@ -49,8 +49,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" diff --git a/compose.yaml b/compose.yaml index 82cf3c0..ea5ab0d 100644 --- a/compose.yaml +++ b/compose.yaml @@ -61,7 +61,6 @@ services: - app-network environment: SERVER_NAME: localhost api.openchurch.local admin.openchurch.local - DATABASE_URL: mysql://root:openchurch@db:3306/openchurch?serverVersion=11.5.2-MariaDB&charset=utf8mb4 volumes: openchurch_db_data: {} diff --git a/migrations/Version20241203150437.php b/migrations/Version20241203150437.php new file mode 100644 index 0000000..271dd8f --- /dev/null +++ b/migrations/Version20241203150437.php @@ -0,0 +1,29 @@ +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'); + } +}