|
|
@@ -85,36 +85,36 @@ class MysqlSchemaTest extends TestCase
|
|
|
['type' => 'boolean', 'length' => null],
|
|
|
],
|
|
|
[
|
|
|
- 'TINYINT(2)',
|
|
|
- ['type' => 'tinyinteger', 'length' => 2, 'unsigned' => false],
|
|
|
+ 'TINYINT(1) UNSIGNED',
|
|
|
+ ['type' => 'boolean', 'length' => null],
|
|
|
],
|
|
|
[
|
|
|
'TINYINT(3)',
|
|
|
- ['type' => 'tinyinteger', 'length' => 3, 'unsigned' => false],
|
|
|
+ ['type' => 'tinyinteger', 'length' => null, 'unsigned' => false],
|
|
|
],
|
|
|
[
|
|
|
'TINYINT(3) UNSIGNED',
|
|
|
- ['type' => 'tinyinteger', 'length' => 3, 'unsigned' => true],
|
|
|
+ ['type' => 'tinyinteger', 'length' => null, 'unsigned' => true],
|
|
|
],
|
|
|
[
|
|
|
'SMALLINT(4)',
|
|
|
- ['type' => 'smallinteger', 'length' => 4, 'unsigned' => false],
|
|
|
+ ['type' => 'smallinteger', 'length' => null, 'unsigned' => false],
|
|
|
],
|
|
|
[
|
|
|
'SMALLINT(4) UNSIGNED',
|
|
|
- ['type' => 'smallinteger', 'length' => 4, 'unsigned' => true],
|
|
|
+ ['type' => 'smallinteger', 'length' => null, 'unsigned' => true],
|
|
|
],
|
|
|
[
|
|
|
'INTEGER(11)',
|
|
|
- ['type' => 'integer', 'length' => 11, 'unsigned' => false],
|
|
|
+ ['type' => 'integer', 'length' => null, 'unsigned' => false],
|
|
|
],
|
|
|
[
|
|
|
'MEDIUMINT(11)',
|
|
|
- ['type' => 'integer', 'length' => 11, 'unsigned' => false],
|
|
|
+ ['type' => 'integer', 'length' => null, 'unsigned' => false],
|
|
|
],
|
|
|
[
|
|
|
'INTEGER(11) UNSIGNED',
|
|
|
- ['type' => 'integer', 'length' => 11, 'unsigned' => true],
|
|
|
+ ['type' => 'integer', 'length' => null, 'unsigned' => true],
|
|
|
],
|
|
|
[
|
|
|
'BIGINT',
|
|
|
@@ -267,7 +267,7 @@ class MysqlSchemaTest extends TestCase
|
|
|
|
|
|
$table = <<<SQL
|
|
|
CREATE TABLE schema_authors (
|
|
|
- id INT(11) PRIMARY KEY AUTO_INCREMENT,
|
|
|
+ id INT PRIMARY KEY AUTO_INCREMENT,
|
|
|
name VARCHAR(50),
|
|
|
bio TEXT,
|
|
|
created DATETIME
|
|
|
@@ -280,7 +280,7 @@ SQL;
|
|
|
id BIGINT PRIMARY KEY AUTO_INCREMENT,
|
|
|
title VARCHAR(20) COMMENT 'A title',
|
|
|
body TEXT,
|
|
|
- author_id INT(11) NOT NULL,
|
|
|
+ author_id INT NOT NULL,
|
|
|
published BOOLEAN DEFAULT 0,
|
|
|
allow_comments TINYINT(1) DEFAULT 0,
|
|
|
created DATETIME,
|
|
|
@@ -295,7 +295,7 @@ SQL;
|
|
|
if ($connection->getDriver()->supportsNativeJson()) {
|
|
|
$table = <<<SQL
|
|
|
CREATE TABLE schema_json (
|
|
|
- id INT(11) PRIMARY KEY AUTO_INCREMENT,
|
|
|
+ id INT PRIMARY KEY AUTO_INCREMENT,
|
|
|
data JSON NOT NULL
|
|
|
)
|
|
|
SQL;
|
|
|
@@ -340,7 +340,7 @@ SQL;
|
|
|
'null' => false,
|
|
|
'unsigned' => false,
|
|
|
'default' => null,
|
|
|
- 'length' => 20,
|
|
|
+ 'length' => null,
|
|
|
'precision' => null,
|
|
|
'comment' => null,
|
|
|
'autoIncrement' => true,
|
|
|
@@ -368,7 +368,7 @@ SQL;
|
|
|
'null' => false,
|
|
|
'unsigned' => false,
|
|
|
'default' => null,
|
|
|
- 'length' => 11,
|
|
|
+ 'length' => null,
|
|
|
'precision' => null,
|
|
|
'comment' => null,
|
|
|
'autoIncrement' => null,
|
|
|
@@ -490,7 +490,7 @@ SQL;
|
|
|
$sql = <<<SQL
|
|
|
CREATE TABLE `odd_primary_key` (
|
|
|
`id` BIGINT UNSIGNED NOT NULL,
|
|
|
-`other_field` INTEGER(11) NOT NULL AUTO_INCREMENT,
|
|
|
+`other_field` INTEGER NOT NULL AUTO_INCREMENT,
|
|
|
PRIMARY KEY (`id`),
|
|
|
UNIQUE KEY `other_field` (`other_field`)
|
|
|
)
|
|
|
@@ -510,7 +510,7 @@ SQL;
|
|
|
|
|
|
$output = $table->createSql($connection);
|
|
|
$this->assertStringContainsString('`id` BIGINT UNSIGNED NOT NULL,', $output[0]);
|
|
|
- $this->assertStringContainsString('`other_field` INTEGER(11) NOT NULL AUTO_INCREMENT,', $output[0]);
|
|
|
+ $this->assertStringContainsString('`other_field` INTEGER NOT NULL AUTO_INCREMENT,', $output[0]);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -637,57 +637,57 @@ SQL;
|
|
|
// Integers
|
|
|
[
|
|
|
'post_id',
|
|
|
- ['type' => 'tinyinteger', 'length' => 2],
|
|
|
- '`post_id` TINYINT(2)',
|
|
|
+ ['type' => 'tinyinteger'],
|
|
|
+ '`post_id` TINYINT',
|
|
|
],
|
|
|
[
|
|
|
'post_id',
|
|
|
- ['type' => 'tinyinteger', 'length' => 2, 'unsigned' => true],
|
|
|
- '`post_id` TINYINT(2) UNSIGNED',
|
|
|
+ ['type' => 'tinyinteger', 'unsigned' => true],
|
|
|
+ '`post_id` TINYINT UNSIGNED',
|
|
|
],
|
|
|
[
|
|
|
'post_id',
|
|
|
- ['type' => 'smallinteger', 'length' => 4],
|
|
|
- '`post_id` SMALLINT(4)',
|
|
|
+ ['type' => 'smallinteger'],
|
|
|
+ '`post_id` SMALLINT',
|
|
|
],
|
|
|
[
|
|
|
'post_id',
|
|
|
- ['type' => 'smallinteger', 'length' => 4, 'unsigned' => true],
|
|
|
- '`post_id` SMALLINT(4) UNSIGNED',
|
|
|
+ ['type' => 'smallinteger', 'unsigned' => true],
|
|
|
+ '`post_id` SMALLINT UNSIGNED',
|
|
|
],
|
|
|
[
|
|
|
'post_id',
|
|
|
- ['type' => 'integer', 'length' => 11],
|
|
|
- '`post_id` INTEGER(11)',
|
|
|
+ ['type' => 'integer'],
|
|
|
+ '`post_id` INTEGER',
|
|
|
],
|
|
|
[
|
|
|
'post_id',
|
|
|
- ['type' => 'integer', 'length' => 11, 'unsigned' => true],
|
|
|
- '`post_id` INTEGER(11) UNSIGNED',
|
|
|
+ ['type' => 'integer', 'unsigned' => true],
|
|
|
+ '`post_id` INTEGER UNSIGNED',
|
|
|
],
|
|
|
[
|
|
|
'post_id',
|
|
|
- ['type' => 'biginteger', 'length' => 20],
|
|
|
+ ['type' => 'biginteger'],
|
|
|
'`post_id` BIGINT',
|
|
|
],
|
|
|
[
|
|
|
'post_id',
|
|
|
- ['type' => 'biginteger', 'length' => 20, 'unsigned' => true],
|
|
|
+ ['type' => 'biginteger', 'unsigned' => true],
|
|
|
'`post_id` BIGINT UNSIGNED',
|
|
|
],
|
|
|
[
|
|
|
'post_id',
|
|
|
- ['type' => 'integer', 'length' => 20, 'autoIncrement' => true],
|
|
|
- '`post_id` INTEGER(20) AUTO_INCREMENT',
|
|
|
+ ['type' => 'integer', 'autoIncrement' => true],
|
|
|
+ '`post_id` INTEGER AUTO_INCREMENT',
|
|
|
],
|
|
|
[
|
|
|
'post_id',
|
|
|
- ['type' => 'integer', 'length' => 20, 'null' => false, 'autoIncrement' => false],
|
|
|
- '`post_id` INTEGER(20) NOT NULL',
|
|
|
+ ['type' => 'integer', 'null' => false, 'autoIncrement' => false],
|
|
|
+ '`post_id` INTEGER NOT NULL',
|
|
|
],
|
|
|
[
|
|
|
'post_id',
|
|
|
- ['type' => 'biginteger', 'length' => 20, 'autoIncrement' => true],
|
|
|
+ ['type' => 'biginteger', 'autoIncrement' => true],
|
|
|
'`post_id` BIGINT AUTO_INCREMENT',
|
|
|
],
|
|
|
// Decimal
|