Skip to content

Commit

Permalink
Removing baseType from the output of Table::column()
Browse files Browse the repository at this point in the history
This makes the output less confusing and also more backwards compatible
  • Loading branch information
lorenzo committed Jul 10, 2015
1 parent 0e57767 commit 722cbf8
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 36 deletions.
4 changes: 3 additions & 1 deletion src/Database/Schema/Table.php
Expand Up @@ -321,7 +321,9 @@ public function column($name)
if (!isset($this->_columns[$name])) {
return null;
}
return $this->_columns[$name];
$column = $this->_columns[$name];
unset($column['baseType']);
return $column;
}

/**
Expand Down
7 changes: 0 additions & 7 deletions tests/TestCase/Database/Schema/MysqlSchemaTest.php
Expand Up @@ -254,7 +254,6 @@ public function testDescribeTable()
$expected = [
'id' => [
'type' => 'biginteger',
'baseType' => null,
'null' => false,
'unsigned' => false,
'default' => null,
Expand All @@ -265,7 +264,6 @@ public function testDescribeTable()
],
'title' => [
'type' => 'string',
'baseType' => null,
'null' => true,
'default' => null,
'length' => 20,
Expand All @@ -275,7 +273,6 @@ public function testDescribeTable()
],
'body' => [
'type' => 'text',
'baseType' => null,
'null' => true,
'default' => null,
'length' => null,
Expand All @@ -284,7 +281,6 @@ public function testDescribeTable()
],
'author_id' => [
'type' => 'integer',
'baseType' => null,
'null' => false,
'unsigned' => false,
'default' => null,
Expand All @@ -295,7 +291,6 @@ public function testDescribeTable()
],
'published' => [
'type' => 'boolean',
'baseType' => null,
'null' => true,
'default' => 0,
'length' => null,
Expand All @@ -304,7 +299,6 @@ public function testDescribeTable()
],
'allow_comments' => [
'type' => 'boolean',
'baseType' => null,
'null' => true,
'default' => 0,
'length' => null,
Expand All @@ -313,7 +307,6 @@ public function testDescribeTable()
],
'created' => [
'type' => 'datetime',
'baseType' => null,
'null' => true,
'default' => null,
'length' => null,
Expand Down
12 changes: 0 additions & 12 deletions tests/TestCase/Database/Schema/PostgresSchemaTest.php
Expand Up @@ -277,7 +277,6 @@ public function testDescribeTable()
$expected = [
'id' => [
'type' => 'biginteger',
'baseType' => null,
'null' => false,
'default' => null,
'length' => 20,
Expand All @@ -288,7 +287,6 @@ public function testDescribeTable()
],
'title' => [
'type' => 'string',
'baseType' => null,
'null' => true,
'default' => null,
'length' => 20,
Expand All @@ -298,7 +296,6 @@ public function testDescribeTable()
],
'body' => [
'type' => 'text',
'baseType' => null,
'null' => true,
'default' => null,
'length' => null,
Expand All @@ -307,7 +304,6 @@ public function testDescribeTable()
],
'author_id' => [
'type' => 'integer',
'baseType' => null,
'null' => false,
'default' => null,
'length' => 10,
Expand All @@ -318,7 +314,6 @@ public function testDescribeTable()
],
'published' => [
'type' => 'boolean',
'baseType' => null,
'null' => true,
'default' => 0,
'length' => null,
Expand All @@ -327,7 +322,6 @@ public function testDescribeTable()
],
'views' => [
'type' => 'integer',
'baseType' => null,
'null' => true,
'default' => 0,
'length' => 5,
Expand All @@ -338,7 +332,6 @@ public function testDescribeTable()
],
'created' => [
'type' => 'timestamp',
'baseType' => null,
'null' => true,
'default' => null,
'length' => null,
Expand Down Expand Up @@ -394,7 +387,6 @@ public function testDescribeTableWithDefaults()
$expected = [
'id' => [
'type' => 'integer',
'baseType' => null,
'null' => false,
'default' => null,
'length' => 10,
Expand All @@ -405,7 +397,6 @@ public function testDescribeTableWithDefaults()
],
'name' => [
'type' => 'string',
'baseType' => null,
'null' => true,
'default' => 'bob',
'length' => 50,
Expand All @@ -415,7 +406,6 @@ public function testDescribeTableWithDefaults()
],
'bio' => [
'type' => 'date',
'baseType' => null,
'null' => true,
'default' => null,
'length' => null,
Expand All @@ -424,7 +414,6 @@ public function testDescribeTableWithDefaults()
],
'position' => [
'type' => 'integer',
'baseType' => null,
'null' => true,
'default' => '1',
'length' => 10,
Expand All @@ -435,7 +424,6 @@ public function testDescribeTableWithDefaults()
],
'created' => [
'type' => 'timestamp',
'baseType' => null,
'null' => true,
'default' => null,
'length' => null,
Expand Down
6 changes: 0 additions & 6 deletions tests/TestCase/Database/Schema/SqliteSchemaTest.php
Expand Up @@ -277,7 +277,6 @@ public function testDescribeTable()
$expected = [
'id' => [
'type' => 'integer',
'baseType' => null,
'null' => false,
'default' => null,
'length' => null,
Expand All @@ -288,7 +287,6 @@ public function testDescribeTable()
],
'title' => [
'type' => 'string',
'baseType' => null,
'null' => true,
'default' => 'testing',
'length' => 20,
Expand All @@ -298,7 +296,6 @@ public function testDescribeTable()
],
'body' => [
'type' => 'text',
'baseType' => null,
'null' => true,
'default' => null,
'length' => null,
Expand All @@ -307,7 +304,6 @@ public function testDescribeTable()
],
'author_id' => [
'type' => 'integer',
'baseType' => null,
'null' => false,
'default' => null,
'length' => 11,
Expand All @@ -318,7 +314,6 @@ public function testDescribeTable()
],
'published' => [
'type' => 'boolean',
'baseType' => null,
'null' => true,
'default' => 0,
'length' => null,
Expand All @@ -327,7 +322,6 @@ public function testDescribeTable()
],
'created' => [
'type' => 'datetime',
'baseType' => null,
'null' => true,
'default' => null,
'length' => null,
Expand Down
7 changes: 0 additions & 7 deletions tests/TestCase/Database/Schema/SqlserverSchemaTest.php
Expand Up @@ -283,7 +283,6 @@ public function testDescribeTable()
$expected = [
'id' => [
'type' => 'biginteger',
'baseType' => null,
'null' => false,
'default' => null,
'length' => 19,
Expand All @@ -294,7 +293,6 @@ public function testDescribeTable()
],
'title' => [
'type' => 'string',
'baseType' => null,
'null' => true,
'default' => null,
'length' => 20,
Expand All @@ -304,7 +302,6 @@ public function testDescribeTable()
],
'body' => [
'type' => 'string',
'baseType' => null,
'null' => true,
'default' => null,
'length' => 1000,
Expand All @@ -314,7 +311,6 @@ public function testDescribeTable()
],
'author_id' => [
'type' => 'integer',
'baseType' => null,
'null' => false,
'default' => null,
'length' => 10,
Expand All @@ -325,7 +321,6 @@ public function testDescribeTable()
],
'published' => [
'type' => 'boolean',
'baseType' => null,
'null' => true,
'default' => 0,
'length' => null,
Expand All @@ -334,7 +329,6 @@ public function testDescribeTable()
],
'views' => [
'type' => 'integer',
'baseType' => null,
'null' => true,
'default' => 0,
'length' => 5,
Expand All @@ -345,7 +339,6 @@ public function testDescribeTable()
],
'created' => [
'type' => 'timestamp',
'baseType' => null,
'null' => true,
'default' => null,
'length' => null,
Expand Down
3 changes: 0 additions & 3 deletions tests/TestCase/Database/Schema/TableTest.php
Expand Up @@ -205,7 +205,6 @@ public function testAddColumnFiltersAttributes()
$result = $table->column('title');
$expected = [
'type' => 'string',
'baseType' => null,
'length' => null,
'precision' => null,
'default' => null,
Expand All @@ -221,7 +220,6 @@ public function testAddColumnFiltersAttributes()
$result = $table->column('author_id');
$expected = [
'type' => 'integer',
'baseType' => null,
'length' => null,
'precision' => null,
'default' => null,
Expand All @@ -238,7 +236,6 @@ public function testAddColumnFiltersAttributes()
$result = $table->column('amount');
$expected = [
'type' => 'decimal',
'baseType' => null,
'length' => null,
'precision' => null,
'default' => null,
Expand Down

0 comments on commit 722cbf8

Please sign in to comment.