[bug#74058,1/2] gnu: postgresql-configuration: Set default postgresql to #f.

Message ID 20241028111340.17913-1-ngraves@ngraves.fr
State New
Headers
Series Set postgresql default value to #f and warn users. |

Commit Message

Nicolas Graves Oct. 28, 2024, 11:13 a.m. UTC
* gnu/services/databases.scm (postgresql-configuration)[postgresql]:
Set default to #f.
(postgresql-services): Revert default to postgresql-10 (rationale: We
can remove this service at the same time than postgresql-10, in
something like 6 months to a year).
---
 gnu/services/databases.scm | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
  

Comments

Ludovic Courtès Nov. 6, 2024, 4:29 p.m. UTC | #1
Hi,

Nicolas Graves <ngraves@ngraves.fr> skribis:

> * gnu/services/databases.scm (postgresql-configuration)[postgresql]:
> Set default to #f.
> (postgresql-services): Revert default to postgresql-10 (rationale: We
                     ^
No ‘s’.

>  (define-record-type* <postgresql-configuration>
>    postgresql-configuration make-postgresql-configuration
>    postgresql-configuration?
> -  (postgresql         postgresql-configuration-postgresql ;file-like
> -                      (default postgresql))
> +  ;; Setting it to #f ensures that the user sets its current postgresql
> +  ;; explicitely.  Since major upgrades currently require a manual migration
> +  ;; of the database, this way the user is responsible for upgrading properly.
> +  ;; MAYBE TODO: Write an action to automatically upgrade in Guix.
> +  (postgresql         postgresql-configuration-postgresql ;file-like or #f
> +                      (default #f))

How about having *no* default value in that case?  That way, existing
user configs will just fail to build, forcing users to act on it.
(Leaving it to #f would instead result in obscure backtraces.)

Ludo’.
  

Patch

diff --git a/gnu/services/databases.scm b/gnu/services/databases.scm
index 0933eb5e79..f8ae085339 100644
--- a/gnu/services/databases.scm
+++ b/gnu/services/databases.scm
@@ -167,8 +167,12 @@  (define contents
 (define-record-type* <postgresql-configuration>
   postgresql-configuration make-postgresql-configuration
   postgresql-configuration?
-  (postgresql         postgresql-configuration-postgresql ;file-like
-                      (default postgresql))
+  ;; Setting it to #f ensures that the user sets its current postgresql
+  ;; explicitely.  Since major upgrades currently require a manual migration
+  ;; of the database, this way the user is responsible for upgrading properly.
+  ;; MAYBE TODO: Write an action to automatically upgrade in Guix.
+  (postgresql         postgresql-configuration-postgresql ;file-like or #f
+                      (default #f))
   (port               postgresql-configuration-port
                       (default 5432))
   (locale             postgresql-configuration-locale
@@ -346,7 +350,7 @@  (define postgresql-service-type
    (default-value (postgresql-configuration))
    (description "Run the PostgreSQL database server.")))
 
-(define-deprecated (postgresql-service #:key (postgresql postgresql)
+(define-deprecated (postgresql-service #:key (postgresql postgresql-10)
                                        (port 5432)
                                        (locale "en_US.utf8")
                                        (config-file (postgresql-config-file))