Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade recipe for patchlevel/event-sourcing 3.6 #1727

Merged

Conversation

DavidBadura
Copy link
Contributor

@DavidBadura DavidBadura commented Dec 10, 2024

@symfony-recipes-bot symfony-recipes-bot enabled auto-merge (squash) December 10, 2024 11:04
Copy link

github-actions bot commented Dec 10, 2024

Thanks for the PR 😍

How to test these changes in your application

  1. Define the SYMFONY_ENDPOINT environment variable:

    # On Unix-like (BSD, Linux and macOS)
    export SYMFONY_ENDPOINT=https://raw.githubusercontent.com/symfony/recipes-contrib/flex/pull-1727/index.json
    # On Windows
    SET SYMFONY_ENDPOINT=https://raw.githubusercontent.com/symfony/recipes-contrib/flex/pull-1727/index.json
  2. Install the package(s) related to this recipe:

    composer req symfony/flex
    composer req 'patchlevel/event-sourcing-bundle:^3.6'
  3. Don't forget to unset the SYMFONY_ENDPOINT environment variable when done:

    # On Unix-like (BSD, Linux and macOS)
    unset SYMFONY_ENDPOINT
    # On Windows
    SET SYMFONY_ENDPOINT=

Diff between recipe versions

In order to help with the review stage, I'm in charge of computing the diff between the various versions of patched recipes.
I'm going keep this comment up to date with any updates of the attached patch.

patchlevel/event-sourcing-bundle

1.0 vs 1.2
diff --git a/patchlevel/event-sourcing-bundle/1.0/config/packages/patchlevel_event_sourcing.yaml b/patchlevel/event-sourcing-bundle/1.2/config/packages/patchlevel_event_sourcing.yaml
index 2f7f0824..c9d24221 100644
--- a/patchlevel/event-sourcing-bundle/1.0/config/packages/patchlevel_event_sourcing.yaml
+++ b/patchlevel/event-sourcing-bundle/1.2/config/packages/patchlevel_event_sourcing.yaml
@@ -1,3 +1,4 @@
 patchlevel_event_sourcing:
+    aggregates_paths: '%kernel.project_dir%/src'
     connection:
         url: '%env(EVENTSTORE_URL)%'
1.2 vs 2.0
diff --git a/patchlevel/event-sourcing-bundle/1.2/config/packages/patchlevel_event_sourcing.yaml b/patchlevel/event-sourcing-bundle/2.0/config/packages/patchlevel_event_sourcing.yaml
index c9d24221..3460251c 100644
--- a/patchlevel/event-sourcing-bundle/1.2/config/packages/patchlevel_event_sourcing.yaml
+++ b/patchlevel/event-sourcing-bundle/2.0/config/packages/patchlevel_event_sourcing.yaml
@@ -1,4 +1,5 @@
 patchlevel_event_sourcing:
-    aggregates_paths: '%kernel.project_dir%/src'
+    aggregates: '%kernel.project_dir%/src'
+    events: '%kernel.project_dir%/src'
     connection:
         url: '%env(EVENTSTORE_URL)%'
2.0 vs 3.0
diff --git a/patchlevel/event-sourcing-bundle/2.0/config/packages/dev/patchlevel_event_sourcing.yaml b/patchlevel/event-sourcing-bundle/2.0/config/packages/dev/patchlevel_event_sourcing.yaml
deleted file mode 100644
index 8c7ccec8..00000000
--- a/patchlevel/event-sourcing-bundle/2.0/config/packages/dev/patchlevel_event_sourcing.yaml
+++ /dev/null
@@ -1,3 +0,0 @@
-patchlevel_event_sourcing:
-    watch_server:
-        enabled: true
diff --git a/patchlevel/event-sourcing-bundle/2.0/config/packages/patchlevel_event_sourcing.yaml b/patchlevel/event-sourcing-bundle/3.0/config/packages/patchlevel_event_sourcing.yaml
index 3460251c..961c9c4e 100644
--- a/patchlevel/event-sourcing-bundle/2.0/config/packages/patchlevel_event_sourcing.yaml
+++ b/patchlevel/event-sourcing-bundle/3.0/config/packages/patchlevel_event_sourcing.yaml
@@ -3,3 +3,19 @@ patchlevel_event_sourcing:
     events: '%kernel.project_dir%/src'
     connection:
         url: '%env(EVENTSTORE_URL)%'
+
+when@dev:
+    patchlevel_event_sourcing:
+        subscription:
+            catch_up: true
+            throw_on_error: true
+            run_after_aggregate_save: true
+            rebuild_after_file_change: true
+            auto_setup: true
+
+when@test:
+    patchlevel_event_sourcing:
+        subscription:
+            catch_up: true
+            throw_on_error: true
+            run_after_aggregate_save: true
diff --git a/patchlevel/event-sourcing-bundle/2.0/manifest.json b/patchlevel/event-sourcing-bundle/3.0/manifest.json
index 763e21d9..7e41e9cb 100644
--- a/patchlevel/event-sourcing-bundle/2.0/manifest.json
+++ b/patchlevel/event-sourcing-bundle/3.0/manifest.json
@@ -8,8 +8,36 @@
     "env": {
         "#1": "Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url",
         "#3": "",
-        "#4": "EVENTSTORE_URL=\"sqlite:///%kernel.project_dir%/var/data.db\"",
-        "#5": "EVENTSTORE_URL=\"mysql://db_user:[email protected]:3306/db_name?serverVersion=5.7\"",
-        "EVENTSTORE_URL": "postgresql://symfony:[email protected]:5432/app?serverVersion=13&charset=utf8"
+        "#4": "EVENTSTORE_URL=\"pdo-sqlite:///%kernel.project_dir%/var/data.db\"",
+        "#5": "EVENTSTORE_URL=\"pdo-mysql://app:[email protected]:3306/app?serverVersion=8.2\"",
+        "EVENTSTORE_URL": "pdo-pgsql://app:[email protected]:5432/app?serverVersion=16&charset=utf8"
+    },
+    "dockerfile": [
+        "RUN install-php-extensions pdo_pgsql"
+    ],
+    "docker-compose": {
+        "docker-compose.yml": {
+            "services": [
+                "database:",
+                "  image: postgres:${POSTGRES_VERSION:-16}-alpine",
+                "  environment:",
+                "    POSTGRES_DB: ${POSTGRES_DB:-app}",
+                "    # You should definitely change the password in production",
+                "    POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-!ChangeMe!}",
+                "    POSTGRES_USER: ${POSTGRES_USER:-app}",
+                "  volumes:",
+                "    - database_data:/var/lib/postgresql/data:rw",
+                "    # You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!",
+                "    # - ./docker/db/data:/var/lib/postgresql/data:rw"
+            ],
+            "volumes": ["database_data:"]
+        },
+        "docker-compose.override.yml": {
+            "services": [
+                "database:",
+                "  ports:",
+                "    - \"5432\""
+            ]
+        }
     }
 }
diff --git a/patchlevel/event-sourcing-bundle/3.0/post-install.txt b/patchlevel/event-sourcing-bundle/3.0/post-install.txt
new file mode 100644
index 00000000..af47860c
--- /dev/null
+++ b/patchlevel/event-sourcing-bundle/3.0/post-install.txt
@@ -0,0 +1 @@
+  * Modify your EVENTSTORE_URL config in .env
3.0 vs 3.6
diff --git a/patchlevel/event-sourcing-bundle/3.0/config/packages/patchlevel_event_sourcing.yaml b/patchlevel/event-sourcing-bundle/3.6/config/packages/patchlevel_event_sourcing.yaml
index 961c9c4e..c5328f4a 100644
--- a/patchlevel/event-sourcing-bundle/3.0/config/packages/patchlevel_event_sourcing.yaml
+++ b/patchlevel/event-sourcing-bundle/3.6/config/packages/patchlevel_event_sourcing.yaml
@@ -3,6 +3,7 @@ patchlevel_event_sourcing:
     events: '%kernel.project_dir%/src'
     connection:
         url: '%env(EVENTSTORE_URL)%'
+        provide_dedicated_connection: true
 
 when@dev:
     patchlevel_event_sourcing:
diff --git a/patchlevel/event-sourcing-bundle/3.0/manifest.json b/patchlevel/event-sourcing-bundle/3.6/manifest.json
index 7e41e9cb..5cb5b710 100644
--- a/patchlevel/event-sourcing-bundle/3.0/manifest.json
+++ b/patchlevel/event-sourcing-bundle/3.6/manifest.json
@@ -3,7 +3,8 @@
         "Patchlevel\\EventSourcingBundle\\PatchlevelEventSourcingBundle": ["all"]
     },
     "copy-from-recipe": {
-        "config/": "%CONFIG_DIR%/"
+        "config/": "%CONFIG_DIR%/",
+        "migrations/": "migrations/"
     },
     "env": {
         "#1": "Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url",
@@ -18,7 +19,7 @@
     "docker-compose": {
         "docker-compose.yml": {
             "services": [
-                "database:",
+                "eventstore:",
                 "  image: postgres:${POSTGRES_VERSION:-16}-alpine",
                 "  environment:",
                 "    POSTGRES_DB: ${POSTGRES_DB:-app}",
@@ -26,15 +27,15 @@
                 "    POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-!ChangeMe!}",
                 "    POSTGRES_USER: ${POSTGRES_USER:-app}",
                 "  volumes:",
-                "    - database_data:/var/lib/postgresql/data:rw",
+                "    - eventstore_data:/var/lib/postgresql/data:rw",
                 "    # You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!",
                 "    # - ./docker/db/data:/var/lib/postgresql/data:rw"
             ],
-            "volumes": ["database_data:"]
+            "volumes": ["eventstore_data:"]
         },
         "docker-compose.override.yml": {
             "services": [
-                "database:",
+                "eventstore:",
                 "  ports:",
                 "    - \"5432\""
             ]
diff --git a/patchlevel/event-sourcing-bundle/3.6/migrations/.gitignore b/patchlevel/event-sourcing-bundle/3.6/migrations/.gitignore
new file mode 100644
index 00000000..e69de29b

Copy link
Member

@diimpp diimpp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Request changes is due migrations dir.

auto-merge was automatically disabled December 10, 2024 17:11

Head branch was pushed to by a user without write access

@symfony-recipes-bot symfony-recipes-bot enabled auto-merge (squash) December 10, 2024 17:11
@symfony-recipes-bot symfony-recipes-bot merged commit 0b5732e into symfony:main Dec 10, 2024
1 of 2 checks passed
@DavidBadura DavidBadura deleted the patchlevel-event-sourcing-3.6 branch December 10, 2024 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants