I'm trying to change a columns name from "namesurname" (I forogt a comma, so this mistake happened ;-)) to "name" (column "surname" already added). But in the Terminal I see the below error output. Any ideas? Is there a mistake with my constructor? I double-checked, but didn't find anything wrong. According to the Akelos API it says "renameColumn ( $table_name, $old_column_name, $new_column_name)".
Akelos function in "booklink_install.php":
function up_3()
{
$this->renameColumn('authors',
'namesurname', // change old column name...
'name' // ...to new column name
);
}
MySQL Error Output:
(mysqlt): ALTER TABLE authors CHANGE COLUMN namesurname name
-----
1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
ADOConnection._Execute(ALTER TABLE authors CHANGE COLUMN namesurname name , false)% line 854, file: /Library/WebServer/Documents/Frameworks/akelos/vendor/adodb/adodb.inc.php
ADOConnection.Execute(ALTER TABLE authors CHANGE COLUMN namesurname name )% line 268, file: /Library/WebServer/Documents/Frameworks/akelos/vendor/adodb/adodb-datadict.inc.php
ADODB_DataDict.ExecuteSQLArray(Array[1])% line 240, file: /Library/WebServer/Documents/Frameworks/akelos/lib/AkInstaller.php
AkInstaller.renameColumn(authors, namesurname, name, true)% line 82, file: /Users/me/Sites/dev/booklink/app/installers/booklink_installer.php
BooklinkInstaller.up_3(Array[0])% line 156, file: /Library/WebServer/Documents/Frameworks/akelos/lib/AkInstaller.php
-----
(mysqlt): ROLLBACK
-----
-----
(mysqlt): SET AUTOCOMMIT=1
-----
Smart Rollback occurred
Thanks four your help IneX
No. changeColumn() = changeColumnDefinition();
In the meantime:
in your installer up_x() do: $this->db->Execute($sql);
$sql = 'ALTER TABLE authors CHANGE COLUMN namesurname name column_definition'
Works, thank you, Kaste!
$sql = 'ALTER TABLE authors CHANGE COLUMN namesurname name VARCHAR(255)';
$this->db->Execute($sql);
1 to 5 of 5