diff mbox series

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

Message ID 20241106170439.22888-1-ngraves@ngraves.fr
State New
Headers show
Series [bug#74058,v2,1/2] gnu: postgresql-configuration: Set default postgresql to *no*. | expand

Commit Message

Nicolas Graves Nov. 6, 2024, 5:04 p.m. UTC
* gnu/services/databases.scm (postgresql-configuration)[postgresql]:
Set default to *no*.
(postgresql-service): 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 | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Ludovic Courtès Nov. 12, 2024, 9:03 a.m. UTC | #1
Hi,

Nicolas Graves <ngraves@ngraves.fr> skribis:

> * gnu/services/databases.scm (postgresql-configuration)[postgresql]:
> Set default to *no*.
> (postgresql-service): 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 | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/gnu/services/databases.scm b/gnu/services/databases.scm
> index 0933eb5e79..05e2c5f996 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?
> +  ;; Setting it to *no* 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
> -                      (default postgresql))
> +                      (default *no*))

I think we misunderstood each other; when I wrote:

> How about having *no* default value in that case?

I suggested removing the (default …) bit altogether, as in:

  (define-record-type* <postgresql-configuration>
    postgresql-configuration make-postgresql-configuration
    postgresql-configuration?
    (postgresql postgresql-configuration-postgresql)  ;no default value
    …)

That way, users get a syntax error (at macro-expansion time) if they
omit the ‘postgresql’ field.

Does that make sense?

Ludo’.
Nicolas Graves Nov. 12, 2024, 9:51 a.m. UTC | #2
On 2024-11-12 10:03, Ludovic Courtès wrote:

>
> I think we misunderstood each other; when I wrote:

Big indeed ;)

>> How about having *no* default value in that case?
>
> I suggested removing the (default …) bit altogether, as in:
>
>   (define-record-type* <postgresql-configuration>
>     postgresql-configuration make-postgresql-configuration
>     postgresql-configuration?
>     (postgresql postgresql-configuration-postgresql)  ;no default value
>     …)
>
> That way, users get a syntax error (at macro-expansion time) if they
> omit the ‘postgresql’ field.
>
> Does that make sense?

Yep, will resend a version.
diff mbox series

Patch

diff --git a/gnu/services/databases.scm b/gnu/services/databases.scm
index 0933eb5e79..05e2c5f996 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?
+  ;; Setting it to *no* 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
-                      (default postgresql))
+                      (default *no*))
   (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))