dolibarr-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Dolibarr-dev] SQL guidelines into migration scirpt


From: Laurent Destailleur (aka Eldy)
Subject: Re: [Dolibarr-dev] SQL guidelines into migration scirpt
Date: Sun, 8 Nov 2015 18:52:24 +0100

Are you sure you can't specified NOT NULL on MODIFY COLUMN without specified DEFAULT values
Are you sure constraint exists always, and not only if there is already a record with a value null into the field ?


2015-11-06 11:25 GMT+01:00 Florian HENRY <address@hidden>:
Same things

    tinyint or TINYINT(1) => NO
    smallint => YES

    if llx_mytable.my_column varchar(30) (or int or whatever) allow null and we want to disallow null

    ALTER TABLE llx_mytable MODIFY COLUMN my_column varchar(30) NOT NULL => NO
    ALTER TABLE llx_mytable MODIFY COLUMN my_column varchar(30) NOT NULL DEFAULT '' => YES

    We can't specified NOT NULL on MODIFY COLUMN without specified DEFAULT values

    https://github.com/Dolibarr/dolibarr/pull/3918

Regards
   
   
Florian Henry
+33 6 03 76 48 07
address@hidden
http://www.open-concept.pro
Twitter : @_Open_Concept_
Google+ : https://www.google.com/+Open-conceptPro
Le 06/11/2015 11:03, Florian HENRY a écrit :
Hello All,

    During solving an issue https://github.com/Dolibarr/dolibarr/issues/3912
    I've meet some bad SQL practice into core sql migration files.
   
    As dolibarr is PgSql comptabile we must keep in mind some SQL rules :
        for exemple
            ALTER TABLE llx_societe_rib ADD COLUMN frstrecur varchar(16) default 'FRST' after rum;
        will not work in pgsql (due to our SQL wrapper /core/db/pgsql.class.php)
            ALTER TABLE llx_societe_rib ADD COLUMN frstrecur varchar(16) DEFAULT 'FRST' AFTER rum;
        is the good syntax

    a PR is on is way with this fix on 3.8 branch https://github.com/Dolibarr/dolibarr/pull/3911
       
    Should we include into test unit pgsql migration script ?

Regards
-- 
Florian Henry
+33 6 03 76 48 07
address@hidden
http://www.open-concept.pro
Twitter : @_Open_Concept_
Google+ : https://www.google.com/+Open-conceptPro


_______________________________________________
Dolibarr-dev mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/dolibarr-dev


_______________________________________________
Dolibarr-dev mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/dolibarr-dev




--
EMail: address@hidden
Web: http://www.destailleur.fr
------------------------------------------------------------------------------------
Google+: https://plus.google.com/+LaurentDestailleur/
Facebook: https://www.facebook.com/Destailleur.Laurent
Twitter: http://www.twitter.com/eldy10
------------------------------------------------------------------------------------
* Dolibarr (Project leader): http://www.dolibarr.org (make a donation for Dolibarr project via Paypal: address@hidden)
* AWStats (Author) : http://awstats.sourceforge.net (make a donation for AWStats project via Paypal: address@hidden)
* AWBot (Author) : http://awbot.sourceforge.net
* CVSChangeLogBuilder (Author) : http://cvschangelogb.sourceforge.net



reply via email to

[Prev in Thread] Current Thread [Next in Thread]