diff --git a/htdocs/install/check.php b/htdocs/install/check.php index 9e21b994780068e938e2d1e0abaed0617e4eb68f..66a9f7f77bb306cc26247f3616f0136140400d65 100644 --- a/htdocs/install/check.php +++ b/htdocs/install/check.php @@ -392,7 +392,8 @@ else array('from'=>'3.6.0', 'to'=>'3.7.0'), array('from'=>'3.7.0', 'to'=>'3.8.0'), array('from'=>'3.8.0', 'to'=>'3.9.0'), - array('from'=>'3.9.0', 'to'=>'4.0.0') + array('from'=>'3.9.0', 'to'=>'4.0.0'), + array('from'=>'4.0.0', 'to'=>'5.0.0') ); $count=0; diff --git a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql new file mode 100644 index 0000000000000000000000000000000000000000..849a71c935fbec91dbee4998d5bc5cc52185b38e --- /dev/null +++ b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql @@ -0,0 +1,29 @@ +-- +-- Be carefull to requests order. +-- This file must be loaded by calling /install/index.php page +-- when current version is 4.0.0 or higher. +-- +-- To rename a table: ALTER TABLE llx_table RENAME TO llx_table_new; +-- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol; +-- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60); +-- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname; +-- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60); +-- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name; +-- To drop an index: -- VMYSQL4.0 DROP INDEX nomindex on llx_table +-- To drop an index: -- VPGSQL8.0 DROP INDEX nomindex +-- To restrict request to Mysql version x.y minimum use -- VMYSQLx.y +-- To restrict request to Pgsql version x.y minimum use -- VPGSQLx.y +-- To make pk to be auto increment (mysql): VMYSQL4.3 ALTER TABLE llx_c_shipment_mode CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT; +-- To make pk to be auto increment (postgres): VPGSQL8.2 NOT POSSIBLE. MUST DELETE/CREATE TABLE +-- To set a field as NULL: VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name DROP NOT NULL; +-- To set a field as default NULL: VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL; +-- Note: fields with type BLOB/TEXT can't have default value. +-- -- VPGSQL8.2 DELETE FROM llx_usergroup_user WHERE fk_user NOT IN (SELECT rowid from llx_user); +-- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup); + + +ALTER TABLE llx_website ADD COLUMN virtualhost varchar(255) after fk_default_home; + + + + diff --git a/htdocs/install/mysql/tables/llx_website.sql b/htdocs/install/mysql/tables/llx_website.sql index 8dd257ffa697200d352135845cf3ce41e50d2bbf..331e6b085bdc6006298d7ac1d23d6b6c95f4bf29 100644 --- a/htdocs/install/mysql/tables/llx_website.sql +++ b/htdocs/install/mysql/tables/llx_website.sql @@ -25,6 +25,7 @@ CREATE TABLE llx_website description varchar(255), status integer, fk_default_home integer, + virtualhost varchar(255), date_creation datetime, date_modification datetime, tms timestamp diff --git a/htdocs/websites/class/website.class.php b/htdocs/websites/class/website.class.php index e87e830bb770af45c17cfd88cbc77ac0ee2cfffb..a3760a792cec88a933ba809ee357c471dde7dee6 100644 --- a/htdocs/websites/class/website.class.php +++ b/htdocs/websites/class/website.class.php @@ -85,6 +85,12 @@ class Website extends CommonObject * @var integer */ public $fk_default_home; + /** + * @var string + */ + public $virtualhost; + + public $records; /** @@ -143,7 +149,8 @@ class Website extends CommonObject $sql.= 'ref,'; $sql.= 'description,'; $sql.= 'status,'; - $sql.= 'fk_default_home,'; + $sql.= 'fk_default_home,'; + $sql.= 'virtualhost,'; $sql.= 'date_creation,'; $sql.= 'date_modification'; @@ -154,6 +161,7 @@ class Website extends CommonObject $sql .= ' '.(! isset($this->description)?'NULL':"'".$this->db->escape($this->description)."'").','; $sql .= ' '.(! isset($this->status)?'NULL':$this->status).','; $sql .= ' '.(! isset($this->fk_default_home)?'NULL':$this->fk_default_home).','; + $sql .= ' '.(! isset($this->virtualhost)?'NULL':$this->virtualhost).','; $sql .= ' '.(! isset($this->date_creation) || dol_strlen($this->date_creation)==0?'NULL':"'".$this->db->idate($this->date_creation)."'").','; $sql .= ' '.(! isset($this->date_modification) || dol_strlen($this->date_modification)==0?'NULL':"'".$this->db->idate($this->date_modification)."'"); @@ -214,6 +222,7 @@ class Website extends CommonObject $sql .= " t.description,"; $sql .= " t.status,"; $sql .= " t.fk_default_home,"; + $sql .= " t.virtualhost,"; $sql .= " t.date_creation,"; $sql .= " t.date_modification,"; $sql .= " t.tms"; @@ -237,6 +246,7 @@ class Website extends CommonObject $this->description = $obj->description; $this->status = $obj->status; $this->fk_default_home = $obj->fk_default_home; + $this->virtualhost = $obj->virtualhost; $this->date_creation = $this->db->jdate($obj->date_creation); $this->date_modification = $this->db->jdate($obj->date_modification); $this->tms = $this->db->jdate($obj->tms); @@ -281,7 +291,8 @@ class Website extends CommonObject $sql .= " t.ref,"; $sql .= " t.description,"; $sql .= " t.status,"; - $sql .= " t.fk_default_home,"; + $sql .= " t.fk_default_home,"; + $sql .= " t.virtualhost,"; $sql .= " t.date_creation,"; $sql .= " t.date_modification,"; $sql .= " t.tms"; @@ -321,6 +332,7 @@ class Website extends CommonObject $line->description = $obj->description; $line->status = $obj->status; $line->fk_default_home = $obj->fk_default_home; + $line->virtualhost = $obj->virtualhost; $line->date_creation = $this->db->jdate($obj->date_creation); $line->date_modification = $this->db->jdate($obj->date_modification); $line->tms = $this->db->jdate($obj->tms); @@ -380,6 +392,7 @@ class Website extends CommonObject $sql .= ' description = '.(isset($this->description)?"'".$this->db->escape($this->description)."'":"null").','; $sql .= ' status = '.(isset($this->status)?$this->status:"null").','; $sql .= ' fk_default_home = '.(($this->fk_default_home > 0)?$this->fk_default_home:"null").','; + $sql .= ' virtualhost = '.(($this->virtualhost != '')?$this->virtualhost:"null").','; $sql .= ' date_creation = '.(! isset($this->date_creation) || dol_strlen($this->date_creation) != 0 ? "'".$this->db->idate($this->date_creation)."'" : 'null').','; $sql .= ' date_modification = '.(! isset($this->date_modification) || dol_strlen($this->date_modification) != 0 ? "'".$this->db->idate($this->date_modification)."'" : 'null').','; $sql .= ' tms = '.(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : "'".$this->db->idate(dol_now())."'"); @@ -627,6 +640,7 @@ class Website extends CommonObject $this->description = 'A specimen website'; $this->status = ''; $this->fk_default_home = null; + $this->virtualhost = 'http://myvirtualhost'; $this->date_creation = dol_now(); $this->date_modification = dol_now(); $this->tms = dol_now(); @@ -665,6 +679,10 @@ class WebsiteLine * @var int */ public $fk_default_home; + /** + * @var string + */ + public $virtualhost; /** * @var mixed */