]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Adding pgcrypto to postgresql
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Mon, 7 Jul 2025 13:34:03 +0000 (09:34 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Mon, 7 Jul 2025 13:34:03 +0000 (09:34 -0400)
mailleur.spec.in
sql/Makefile
sql/mailleur.sql
support/crdb.sh

index 0f3cac81bc97fe106b875281d99ac2ae9c5ed007..30e1e36bd7bb8a10594a9815e411e064d66aea71 100644 (file)
@@ -141,6 +141,7 @@ Summary             :       mailleur using postgresql as Data-base
 
 Requires       :       %{name}                 =  %{version}-%{release}
 Requires       :       postgresql-server
+Requires       :       postgresql-contrib
 Requires       :       dovecot-postgresql
 
 Obsoletes      :       %{name}-mysql           <= %{version}-%{release}
index 6352c39e1c9141f40b354a32459ae05f3602d3cf..06e75085099cb7d0938e43d06d99ba9dd5f278d7 100644 (file)
@@ -55,6 +55,9 @@ dbpostg       :  mailleur.postg
             echo "CREATE DATABASE mailleur             \
                        ENCODING='UTF8';"               \
             ) | psql -q -U postgres template1
+          @ (                                          \
+            echo "CREATE EXTENSION pgcrypto;"          \
+            ) | psql -q mailleur;
           @ cat mailleur.postg | psql -q mailleur;
           @ cpp -P -DPOSTGRESQL datatest.sql | psql -q mailleur;
           @ echo "POSGRESQL database ready"
@@ -62,6 +65,7 @@ dbpostg       :  mailleur.postg
 ndbpostg:
           @-(                                          \
             echo "drop database mailleur;";            \
+            echo "DROP EXTENSION pgcrypto;";           \
             echo "DROP ROLE apache;";                  \
             echo "DROP ROLE dovecot;";                 \
             ) | psql -q -U postgres template1
index c4da08feedb774db961cd48042221702c00570c5..8af9b8a275d4fda5ab7c580fc398881066897708 100644 (file)
@@ -55,6 +55,10 @@ CREATE TABLE emails  (
        email           TEXTUNIQUE,     //User email
        password        TEXT            //User password
                        DFLT '!',
+       realm           TEXT            //user realm
+                       DFLT 'MAILLEUR-EMAIL',
+       hash            TEXT            //'email:realm:passwor' MD5
+                       DFLT '0ABCD9',
        space           INTEGER         //space used by user email      
                        DFLT 0,
        mxspace         INTEGER         //Maximun space available
index f0f674f95844cdc9843ad017360d61bbedd49dc2..b86e9166facf1cf00b26c5edd53633b415269222 100755 (executable)
@@ -85,6 +85,7 @@ case "$DB_TYPE" in
       echo "CREATE ROLE $APPNAME WITH LOGIN CREATEDB SUPERUSER;"
       echo "CREATE ROLE apache WITH LOGIN;"
       echo "CREATE ROLE dovecot WITH LOGIN;"
+      echo "CREATE EXTENSION pgcrypto;"
       echo "CREATE DATABASE $APPNAME ENCODING='UTF8';"
       ) | /usr/bin/su - -m postgres -c "$SQL $SQLHOST $SQLPORT template1" >> $LOG
       echo "data-base is now created" >> $LOG