Browse Source

Added TYPE_BIGPK to Schema

tags/2.0.0-beta
Alexander Makarov 11 years ago
parent
commit
523a63f576
  1. 1
      framework/yii/db/QueryBuilder.php
  2. 1
      framework/yii/db/Schema.php
  3. 1
      framework/yii/db/cubrid/QueryBuilder.php
  4. 1
      framework/yii/db/mssql/QueryBuilder.php
  5. 2
      framework/yii/db/mysql/QueryBuilder.php
  6. 1
      framework/yii/db/pgsql/QueryBuilder.php
  7. 1
      framework/yii/db/sqlite/QueryBuilder.php

1
framework/yii/db/QueryBuilder.php

@ -491,6 +491,7 @@ class QueryBuilder extends \yii\base\Object
* physical types): * physical types):
* *
* - `pk`: an auto-incremental primary key type, will be converted into "int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY" * - `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)" * - `string`: string type, will be converted into "varchar(255)"
* - `text`: a long string type, will be converted into "text" * - `text`: a long string type, will be converted into "text"
* - `smallint`: a small integer type, will be converted into "smallint(6)" * - `smallint`: a small integer type, will be converted into "smallint(6)"

1
framework/yii/db/Schema.php

@ -35,6 +35,7 @@ abstract class Schema extends Object
* The followings are the supported abstract column data types. * The followings are the supported abstract column data types.
*/ */
const TYPE_PK = 'pk'; const TYPE_PK = 'pk';
const TYPE_BIGPK = 'bigpk';
const TYPE_STRING = 'string'; const TYPE_STRING = 'string';
const TYPE_TEXT = 'text'; const TYPE_TEXT = 'text';
const TYPE_SMALLINT = 'smallint'; const TYPE_SMALLINT = 'smallint';

1
framework/yii/db/cubrid/QueryBuilder.php

@ -22,6 +22,7 @@ class QueryBuilder extends \yii\db\QueryBuilder
*/ */
public $typeMap = array( public $typeMap = array(
Schema::TYPE_PK => 'int NOT NULL AUTO_INCREMENT PRIMARY KEY', 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_STRING => 'varchar(255)',
Schema::TYPE_TEXT => 'varchar', Schema::TYPE_TEXT => 'varchar',
Schema::TYPE_SMALLINT => 'smallint', Schema::TYPE_SMALLINT => 'smallint',

1
framework/yii/db/mssql/QueryBuilder.php

@ -22,6 +22,7 @@ class QueryBuilder extends \yii\db\QueryBuilder
*/ */
public $typeMap = array( public $typeMap = array(
Schema::TYPE_PK => 'int IDENTITY PRIMARY KEY', Schema::TYPE_PK => 'int IDENTITY PRIMARY KEY',
Schema::TYPE_BIGPK => 'bigint IDENTITY PRIMARY KEY',
Schema::TYPE_STRING => 'varchar(255)', Schema::TYPE_STRING => 'varchar(255)',
Schema::TYPE_TEXT => 'text', Schema::TYPE_TEXT => 'text',
Schema::TYPE_SMALLINT => 'smallint(6)', Schema::TYPE_SMALLINT => 'smallint(6)',

2
framework/yii/db/mysql/QueryBuilder.php

@ -9,6 +9,7 @@ namespace yii\db\mysql;
use yii\db\Exception; use yii\db\Exception;
use yii\base\InvalidParamException; use yii\base\InvalidParamException;
use yii\db\sqlite\Schema;
/** /**
* QueryBuilder is the query builder for MySQL databases. * QueryBuilder is the query builder for MySQL databases.
@ -23,6 +24,7 @@ class QueryBuilder extends \yii\db\QueryBuilder
*/ */
public $typeMap = array( public $typeMap = array(
Schema::TYPE_PK => 'int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY', 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_STRING => 'varchar(255)',
Schema::TYPE_TEXT => 'text', Schema::TYPE_TEXT => 'text',
Schema::TYPE_SMALLINT => 'smallint(6)', Schema::TYPE_SMALLINT => 'smallint(6)',

1
framework/yii/db/pgsql/QueryBuilder.php

@ -22,6 +22,7 @@ class QueryBuilder extends \yii\db\QueryBuilder
*/ */
public $typeMap = array( public $typeMap = array(
Schema::TYPE_PK => 'serial NOT NULL PRIMARY KEY', Schema::TYPE_PK => 'serial NOT NULL PRIMARY KEY',
Schema::TYPE_BIGPK => 'bigserial NOT NULL PRIMARY KEY',
Schema::TYPE_STRING => 'varchar(255)', Schema::TYPE_STRING => 'varchar(255)',
Schema::TYPE_TEXT => 'text', Schema::TYPE_TEXT => 'text',
Schema::TYPE_SMALLINT => 'smallint', Schema::TYPE_SMALLINT => 'smallint',

1
framework/yii/db/sqlite/QueryBuilder.php

@ -24,6 +24,7 @@ class QueryBuilder extends \yii\db\QueryBuilder
*/ */
public $typeMap = array( public $typeMap = array(
Schema::TYPE_PK => 'integer PRIMARY KEY AUTOINCREMENT NOT NULL', 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_STRING => 'varchar(255)',
Schema::TYPE_TEXT => 'text', Schema::TYPE_TEXT => 'text',
Schema::TYPE_SMALLINT => 'smallint', Schema::TYPE_SMALLINT => 'smallint',

Loading…
Cancel
Save