From f14080b0add855b6728e620ca1d27e8f0f12a916 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Mon, 2 Oct 2006 16:47:02 +0000 Subject: [PATCH] Prevent "id" fields to be renamed in generators --- lib/xmldb/classes/generators/XMLDBGenerator.class.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/xmldb/classes/generators/XMLDBGenerator.class.php b/lib/xmldb/classes/generators/XMLDBGenerator.class.php index 015d6e4fe5..839af46e8d 100644 --- a/lib/xmldb/classes/generators/XMLDBGenerator.class.php +++ b/lib/xmldb/classes/generators/XMLDBGenerator.class.php @@ -655,6 +655,17 @@ class XMLDBgenerator { $results = array(); //Array where all the sentences will be stored + /// Although this is checked in ddllib - rename_field() - double check + /// that we aren't trying to rename one "id" field. Although it could be + /// implemented (if adding the necessary code to rename sequences, defaults, + /// triggers... and so on under each getRenameFieldExtraSQL() function, it's + /// better to forbide it, mainly because this field is the default PK and + /// in the future, a lot of FKs can be pointing here. So, this field, more + /// or less, must be considered inmutable! + if ($xmldb_field->getName() == 'id') { + return array(); + } + $rename = str_replace('TABLENAME', $this->getTableName($xmldb_table), $this->rename_column_sql); $rename = str_replace('OLDFIELDNAME', $xmldb_field->getName(), $rename); $rename = str_replace('NEWFIELDNAME', $newname, $rename); -- 2.39.5