API CHANGE: The standard ID column is now database-specific

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@71824 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Geoff Munn 2009-02-13 02:37:58 +00:00
parent 11dc761752
commit 040913369d
2 changed files with 13 additions and 2 deletions

View File

@ -236,8 +236,9 @@ abstract class Database extends Object {
$this->checkAndRepairTable($table);
}
$this->requireField($table, "ID", "int(11) not null auto_increment");
//DB ABSTRACTION: we need to convert this to a db-specific version:
$this->requireField($table, 'ID', DB::getConn()->IdColumn());
// Create custom fields
if($fieldSchema) {
foreach($fieldSchema as $fieldName => $fieldSpec) {

View File

@ -573,6 +573,16 @@ class MySQLDatabase extends Database {
return 'varchar(' . $values['precision'] . ') character set utf8 collate utf8_general_ci';
}
/**
* This returns the column which is the primary key for each table
* In Postgres, it is a SERIAL8, which is the equivalent of an auto_increment
*
* @return string
*/
function IdColumn(){
return 'int(11) not null auto_increment';
}
/**
* Returns true if the given table is exists in the current database
* NOTE: Experimental; introduced for db-abstraction and may changed before 2.4 is released.