<?php /* Increase the size of the language field in www_users to enable * utf languages to be accepted */ ChangeColumnSize('language', 'www_users', 'varchar(10)', 'NOT NULL', 'en_GB.utf8', 10, $db); UpdateDBNo(6, $db);
*/ DropPrimaryKey('orderdeliverydifferenceslog', array('orderno', 'invoiceno', 'stockid'), $db); /* Chenge received quantity to a type of double as stock * quantities are not necessarily integers */ ChangeColumnType('recqty', 'loctransfers', 'double', 'NOT NULL', 0.0, $db); /* New system type needed for contract work */ /* Add extra columns to reports */ for ($i = 9; $i <= 20; $i++) { AddColumn('col' . $i . 'width', 'reports', 'int(3)', 'NOT NULL', '25', 'col' . ($i - 1) . 'width', $db); } /* Increase the size of the fieldname field to accomodate all field names */ ChangeColumnSize('fieldname', 'reportfields', 'varchar(80)', 'NOT NULL', '', 80, $db); /* Addin extra fields to stockcatproperties table */ AddColumn('maximumvalue', 'stockcatproperties', 'Double', 'NOT NULL', 999999999, 'defaultvalue', $db); AddColumn('minimumvalue', 'stockcatproperties', 'Double', 'NOT NULL', -999999999, 'maximumvalue', $db); AddColumn('numericvalue', 'stockcatproperties', 'tinyint', 'NOT NULL', 0, 'minimumvalue', $db); /* Lots of database changes required for the move from fixed * asset manager v2 to v3 */ DropTable('assetmanager', 'lifetime', $db); /* Creates the version 2 assetmanager table */ CreateTable("assetmanager", "CREATE TABLE `assetmanager` (\n `id` int(11) NOT NULL auto_increment,\n `stockid` varchar(20) NOT NULL default '',\n `serialno` varchar(30) NOT NULL default '',\n `location` varchar(15) NOT NULL default '',\n `cost` double NOT NULL default '0',\n `depn` double NOT NULL default '0',\n `datepurchased` date NOT NULL default '0000-00-00',\n `disposalvalue` int(11) NOT NULL DEFAULT 0,\n PRIMARY KEY (`id`)\n)", $db); CreateTable("fixedassetlocations", "CREATE TABLE `fixedassetlocations` (\n\t`locationid` char(6) NOT NULL default '',\n\t`locationdescription` char(20) NOT NULL default '',\n\t`parentlocationid` char(6) DEFAULT '',\n\tPRIMARY KEY (`locationid`)\n)", $db); RenameTable('assetmanager', 'fixedassets', $db); AddColumn('assetcategoryid', 'fixedassets', 'varchar(6)', 'NOT NULL', '', 'disposalvalue', $db); AddColumn('description', 'fixedassets', 'varchar(50)', 'NOT NULL', '', 'assetcategoryid', $db);
<?php ChangeColumnSize('areacode', 'areas', 'CHAR(3)', 'NOT NULL', '', 3, $db); UpdateDBNo(basename(__FILE__, '.php'), $db);
<?php /* Change the size of the fieldname field in the report writer as * the previous size was not big enough to hold all field names */ ChangeColumnSize('fieldname', 'reportfields', 'varchar(60)', 'NOT NULL', "''", 60, $db); UpdateDBNo(17, $db);
<?php ChangeColumnSize('host', 'emailsettings', 'VARCHAR(50)', 'NOT NULL', '', 50, $db); ChangeColumnSize('username', 'emailsettings', 'VARCHAR(50)', 'NOT NULL', '', 50, $db); ChangeColumnSize('password', 'emailsettings', 'VARCHAR(50)', 'NOT NULL', '', 50, $db); UpdateDBNo(basename(__FILE__, '.php'), $db);
<?php /* Increase the size of the salesType field to 40 characters */ ChangeColumnSize('sales_type', 'salestypes', 'varchar(40)', 'NOT NULL', '', 40, $db); UpdateDBNo(26, $db);
<?php /* Split the cash sales customer field into debtorno and branchcode * fields */ ChangeColumnSize('cashsalecustomer', 'locations', 'varchar(10)', 'NOT NULL', '', 10, $db); AddColumn('cashsalebranch', 'locations', 'varchar(10)', 'NOT NULL', '', 'cashsalecustomer', $db); $sql = "SELECT loccode, cashsalecustomer FROM locations WHERE cashsalecustomer!=''"; $result = DB_query($sql, $db); while ($myrow = DB_fetch_array($result, $db)) { $CustArray = explode('-', $myrow['cashsalecustomer']); $UpdateSQL = "UPDATE locations\n\t\t\t\tSET cashsalecustomer='" . $CustArray[0] . "',\n\t\t\t\t\tcashsalebranch='" . $CustArray[1] . "'\n\t\t\t\tWHERE loccode='" . $myrow['loccode'] . "'"; $UpdateRow = DB_query($UpdateSQL, $db); } UpdateDBNo(55, $db);
<?php ChangeColumnSize('reference', 'stockmoves', 'VARCHAR(100)', 'NOT NULL', '', 100, $db); UpdateDBNo(basename(__FILE__, '.php'), $db);