Skip to content

Commit

Permalink
Added TYPE_BIGPK to Schema
Browse files Browse the repository at this point in the history
  • Loading branch information
samdark committed Sep 15, 2013
1 parent a2b4ef0 commit 523a63f
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions framework/yii/db/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ public function checkIntegrity($check = true, $schema = '', $table = '')
* physical types):
*
* - `pk`: an auto-incremental primary key type, will be converted into "int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY"
* - `bigpk`: an auto-incremental primary key type, will be converted into "bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY"
* - `string`: string type, will be converted into "varchar(255)"
* - `text`: a long string type, will be converted into "text"
* - `smallint`: a small integer type, will be converted into "smallint(6)"
Expand Down
1 change: 1 addition & 0 deletions framework/yii/db/Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ abstract class Schema extends Object
* The followings are the supported abstract column data types.
*/
const TYPE_PK = 'pk';
const TYPE_BIGPK = 'bigpk';
const TYPE_STRING = 'string';
const TYPE_TEXT = 'text';
const TYPE_SMALLINT = 'smallint';
Expand Down
1 change: 1 addition & 0 deletions framework/yii/db/cubrid/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class QueryBuilder extends \yii\db\QueryBuilder
*/
public $typeMap = array(
Schema::TYPE_PK => 'int NOT NULL AUTO_INCREMENT PRIMARY KEY',
Schema::TYPE_BIGPK => 'bigint NOT NULL AUTO_INCREMENT PRIMARY KEY',
Schema::TYPE_STRING => 'varchar(255)',
Schema::TYPE_TEXT => 'varchar',
Schema::TYPE_SMALLINT => 'smallint',
Expand Down
1 change: 1 addition & 0 deletions framework/yii/db/mssql/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class QueryBuilder extends \yii\db\QueryBuilder
*/
public $typeMap = array(
Schema::TYPE_PK => 'int IDENTITY PRIMARY KEY',
Schema::TYPE_BIGPK => 'bigint IDENTITY PRIMARY KEY',
Schema::TYPE_STRING => 'varchar(255)',
Schema::TYPE_TEXT => 'text',
Schema::TYPE_SMALLINT => 'smallint(6)',
Expand Down
2 changes: 2 additions & 0 deletions framework/yii/db/mysql/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

use yii\db\Exception;
use yii\base\InvalidParamException;
use yii\db\sqlite\Schema;

/**
* QueryBuilder is the query builder for MySQL databases.
Expand All @@ -23,6 +24,7 @@ class QueryBuilder extends \yii\db\QueryBuilder
*/
public $typeMap = array(
Schema::TYPE_PK => 'int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY',
Schema::TYPE_BIGPK => 'bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY',
Schema::TYPE_STRING => 'varchar(255)',
Schema::TYPE_TEXT => 'text',
Schema::TYPE_SMALLINT => 'smallint(6)',
Expand Down
1 change: 1 addition & 0 deletions framework/yii/db/pgsql/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class QueryBuilder extends \yii\db\QueryBuilder
*/
public $typeMap = array(
Schema::TYPE_PK => 'serial NOT NULL PRIMARY KEY',
Schema::TYPE_BIGPK => 'bigserial NOT NULL PRIMARY KEY',
Schema::TYPE_STRING => 'varchar(255)',
Schema::TYPE_TEXT => 'text',
Schema::TYPE_SMALLINT => 'smallint',
Expand Down
2 changes: 1 addition & 1 deletion framework/yii/db/pgsql/Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ protected function findColumns($table)
information_schema._pg_char_max_length(information_schema._pg_truetypid(a, t), information_schema._pg_truetypmod(a, t))
AS numeric
) AS size,
a.attnum = any (ct.conkey) as is_pkey
a.attnum = any (ct.conkey) as is_pkey
FROM
pg_class c
LEFT JOIN pg_attribute a ON a.attrelid = c.oid
Expand Down
1 change: 1 addition & 0 deletions framework/yii/db/sqlite/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class QueryBuilder extends \yii\db\QueryBuilder
*/
public $typeMap = array(
Schema::TYPE_PK => 'integer PRIMARY KEY AUTOINCREMENT NOT NULL',
Schema::TYPE_BIGPK => 'integer PRIMARY KEY AUTOINCREMENT NOT NULL',
Schema::TYPE_STRING => 'varchar(255)',
Schema::TYPE_TEXT => 'text',
Schema::TYPE_SMALLINT => 'smallint',
Expand Down

0 comments on commit 523a63f

Please sign in to comment.