From 211b79a577f546ac18dec575ec0a0bd15ce78278 Mon Sep 17 00:00:00 2001 From: Matthew Wilson Date: Thu, 5 Jun 2025 14:09:52 +0300 Subject: [PATCH 1/3] Add requirements for using Flyway --- .../database/flyway-migrations.adoc | 39 +++++++------------ articles/control-center/database/index.adoc | 17 ++++++-- 2 files changed, 29 insertions(+), 27 deletions(-) diff --git a/articles/control-center/database/flyway-migrations.adoc b/articles/control-center/database/flyway-migrations.adoc index 0c577ad687..1d70e5ff37 100644 --- a/articles/control-center/database/flyway-migrations.adoc +++ b/articles/control-center/database/flyway-migrations.adoc @@ -14,7 +14,7 @@ Control Center provides a simple way to set up Flyway migrations to initialize y == Control Center Starter -Adding the Control Center Starter to your project dependencies brings in the Flyway dependency. This allows you to manage your database migrations easily. If you haven't already done so, add the Control Center Starter to your project. +If you haven't already done so, add the Control Center Starter to your project. You will also need to ensure that you have the Flyway PostgreSQL and PostgreSQL dependencies in your project. .pom.xml [source,xml] @@ -23,31 +23,22 @@ Adding the Control Center Starter to your project dependencies brings in the Fly com.vaadin control-center-starter + + org.flywaydb + flyway-database-postgresql + 11.7.2 + runtime + + + org.postgresql + postgresql + runtime + ---- -Once this dependency is added, any migrations you create are automatically detected and applied to your database when the application starts. - -[NOTE] -==== -If you want to use the Control Center Starter without Flyway migrations, you can disable them by setting the `spring.flyway.enabled` property to `false` in your `application.properties` or `application.yaml` file: +Once these dependencies are added and the Database feature is enabled, any migrations you create are automatically detected and applied to your database when the application starts. -[.example] --- -.application.properties -[source,properties] ----- -spring.flyway.enabled=false ----- - -.application.yaml -[source,yaml] ----- -spring: - flyway: - enabled: false ----- --- -==== +IMPORTANT: The Database feature must be <<../database#provisioning-a-database,enabled>> in order for Flyway migrations to be applied to the Control Center-managed database. If you have not already enabled the Database feature, you can do so during the deployment of your application or for an application that is already deployed. == Migration Files @@ -73,7 +64,7 @@ More information about Flyway migration files can be found in the https://flyway == Viewing Migration Status -If you have <<../database#provisioning-a-database,enabled the Database feature>>, you can view the status of your Flyway migrations in the Control Center UI. +You can view the status of your Flyway migrations in the Control Center UI. To view the details of the applied migrations, first select the relevant application from the [guilabel]*Application Selector*, as shown in the screenshot here. diff --git a/articles/control-center/database/index.adoc b/articles/control-center/database/index.adoc index 08dbcf1c78..d293cdbfe1 100644 --- a/articles/control-center/database/index.adoc +++ b/articles/control-center/database/index.adoc @@ -14,10 +14,21 @@ Control Center provides a simple way to provision a database for your Vaadin app You can enable the Database feature either during the deployment of your application or for an application that is already deployed. When enabled, Control Center automatically provisions a dedicated PostgreSQL database exclusively for that application. If your application is configured to use a Spring datasource, the necessary connection details are set up automatically. +Since the database is PostgreSQL, you must use the PostgreSQL JDBC driver to connect to it. Make sure to include the PostgreSQL dependency in your project. Add the following dependency to your `pom.xml`: + +.pom.xml +[source,xml] +---- + + org.postgresql + postgresql + runtime + +---- + + == Database Migrations A database migration is a process that manages incremental, reversible changes to a database schema over time. Migrations allow you to evolve your database structure safely and predictably, ensuring that your application and its data remain consistent as requirements change. -Control Center integrates with Flyway for managing database migrations. When you enable the Database feature, Control Center automatically detects and applies Flyway migration scripts to the newly provisioned database. This ensures that your database schema is always up to date with your application's requirements. For more information about Flyway migrations, see the https://flywaydb.org/documentation/[Flyway documentation]. - -For more information about how to use Flyway migrations with Control Center, see the <<./flyway-migrations#,Flyway Migrations>> page. +Control Center integrates with Flyway for managing database migrations. For more information about how to use Flyway migrations with Control Center, see the <<./flyway-migrations#,Flyway Migrations>> page. From 8891985d8ce09d4165d7142828fbe37001dc3106 Mon Sep 17 00:00:00 2001 From: Matthew Wilson Date: Thu, 5 Jun 2025 14:41:04 +0300 Subject: [PATCH 2/3] Address AI and vale comments --- articles/control-center/database/flyway-migrations.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/articles/control-center/database/flyway-migrations.adoc b/articles/control-center/database/flyway-migrations.adoc index 1d70e5ff37..55c4a90d24 100644 --- a/articles/control-center/database/flyway-migrations.adoc +++ b/articles/control-center/database/flyway-migrations.adoc @@ -14,7 +14,7 @@ Control Center provides a simple way to set up Flyway migrations to initialize y == Control Center Starter -If you haven't already done so, add the Control Center Starter to your project. You will also need to ensure that you have the Flyway PostgreSQL and PostgreSQL dependencies in your project. +If you haven't already done so, add the Control Center Starter to your project. You also need to ensure that you have the Flyway PostgreSQL and PostgreSQL dependencies in your project. .pom.xml [source,xml] @@ -38,7 +38,7 @@ If you haven't already done so, add the Control Center Starter to your project. Once these dependencies are added and the Database feature is enabled, any migrations you create are automatically detected and applied to your database when the application starts. -IMPORTANT: The Database feature must be <<../database#provisioning-a-database,enabled>> in order for Flyway migrations to be applied to the Control Center-managed database. If you have not already enabled the Database feature, you can do so during the deployment of your application or for an application that is already deployed. +NOTE: The Database feature must be <<../database#provisioning-a-database,enabled>> in order for Flyway migrations to be applied to the Control Center-managed database. If you have not already enabled the Database feature, you can do so during the deployment of your application or for an application that is already deployed. == Migration Files From 2800a0962f09162345e8381f2ac987cd9eabd22a Mon Sep 17 00:00:00 2001 From: Matthew Wilson Date: Thu, 5 Jun 2025 15:19:19 +0300 Subject: [PATCH 3/3] Remove sections about postgresql dependency --- .../control-center/database/flyway-migrations.adoc | 7 +------ articles/control-center/database/index.adoc | 12 ------------ 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/articles/control-center/database/flyway-migrations.adoc b/articles/control-center/database/flyway-migrations.adoc index 55c4a90d24..93d2a21193 100644 --- a/articles/control-center/database/flyway-migrations.adoc +++ b/articles/control-center/database/flyway-migrations.adoc @@ -14,7 +14,7 @@ Control Center provides a simple way to set up Flyway migrations to initialize y == Control Center Starter -If you haven't already done so, add the Control Center Starter to your project. You also need to ensure that you have the Flyway PostgreSQL and PostgreSQL dependencies in your project. +If you haven't already done so, add the Control Center Starter to your project. You also need to ensure that you have the Flyway PostgreSQL dependency in your project. .pom.xml [source,xml] @@ -29,11 +29,6 @@ If you haven't already done so, add the Control Center Starter to your project. 11.7.2 runtime - - org.postgresql - postgresql - runtime - ---- Once these dependencies are added and the Database feature is enabled, any migrations you create are automatically detected and applied to your database when the application starts. diff --git a/articles/control-center/database/index.adoc b/articles/control-center/database/index.adoc index d293cdbfe1..28d9401407 100644 --- a/articles/control-center/database/index.adoc +++ b/articles/control-center/database/index.adoc @@ -14,18 +14,6 @@ Control Center provides a simple way to provision a database for your Vaadin app You can enable the Database feature either during the deployment of your application or for an application that is already deployed. When enabled, Control Center automatically provisions a dedicated PostgreSQL database exclusively for that application. If your application is configured to use a Spring datasource, the necessary connection details are set up automatically. -Since the database is PostgreSQL, you must use the PostgreSQL JDBC driver to connect to it. Make sure to include the PostgreSQL dependency in your project. Add the following dependency to your `pom.xml`: - -.pom.xml -[source,xml] ----- - - org.postgresql - postgresql - runtime - ----- - == Database Migrations