Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions src/Illuminate/Database/Schema/Blueprint.php
Original file line number Diff line number Diff line change
Expand Up @@ -1103,7 +1103,7 @@ public function date($column)
* @param int|null $precision
* @return \Illuminate\Database\Schema\ColumnDefinition
*/
public function dateTime($column, $precision = 0)
public function dateTime($column, $precision = null)
{
return $this->addColumn('dateTime', $column, compact('precision'));
}
Expand All @@ -1115,7 +1115,7 @@ public function dateTime($column, $precision = 0)
* @param int|null $precision
* @return \Illuminate\Database\Schema\ColumnDefinition
*/
public function dateTimeTz($column, $precision = 0)
public function dateTimeTz($column, $precision = null)
{
return $this->addColumn('dateTimeTz', $column, compact('precision'));
}
Expand All @@ -1127,7 +1127,7 @@ public function dateTimeTz($column, $precision = 0)
* @param int|null $precision
* @return \Illuminate\Database\Schema\ColumnDefinition
*/
public function time($column, $precision = 0)
public function time($column, $precision = null)
{
return $this->addColumn('time', $column, compact('precision'));
}
Expand All @@ -1139,7 +1139,7 @@ public function time($column, $precision = 0)
* @param int|null $precision
* @return \Illuminate\Database\Schema\ColumnDefinition
*/
public function timeTz($column, $precision = 0)
public function timeTz($column, $precision = null)
{
return $this->addColumn('timeTz', $column, compact('precision'));
}
Expand All @@ -1151,7 +1151,7 @@ public function timeTz($column, $precision = 0)
* @param int|null $precision
* @return \Illuminate\Database\Schema\ColumnDefinition
*/
public function timestamp($column, $precision = 0)
public function timestamp($column, $precision = null)
{
return $this->addColumn('timestamp', $column, compact('precision'));
}
Expand All @@ -1163,7 +1163,7 @@ public function timestamp($column, $precision = 0)
* @param int|null $precision
* @return \Illuminate\Database\Schema\ColumnDefinition
*/
public function timestampTz($column, $precision = 0)
public function timestampTz($column, $precision = null)
{
return $this->addColumn('timestampTz', $column, compact('precision'));
}
Expand All @@ -1174,7 +1174,7 @@ public function timestampTz($column, $precision = 0)
* @param int|null $precision
* @return void
*/
public function timestamps($precision = 0)
public function timestamps($precision = null)
{
$this->timestamp('created_at', $precision)->nullable();

Expand All @@ -1189,7 +1189,7 @@ public function timestamps($precision = 0)
* @param int|null $precision
* @return void
*/
public function nullableTimestamps($precision = 0)
public function nullableTimestamps($precision = null)
{
$this->timestamps($precision);
}
Expand All @@ -1200,7 +1200,7 @@ public function nullableTimestamps($precision = 0)
* @param int|null $precision
* @return void
*/
public function timestampsTz($precision = 0)
public function timestampsTz($precision = null)
{
$this->timestampTz('created_at', $precision)->nullable();

Expand All @@ -1213,7 +1213,7 @@ public function timestampsTz($precision = 0)
* @param int|null $precision
* @return void
*/
public function datetimes($precision = 0)
public function datetimes($precision = null)
{
$this->datetime('created_at', $precision)->nullable();

Expand All @@ -1227,7 +1227,7 @@ public function datetimes($precision = 0)
* @param int|null $precision
* @return \Illuminate\Database\Schema\ColumnDefinition
*/
public function softDeletes($column = 'deleted_at', $precision = 0)
public function softDeletes($column = 'deleted_at', $precision = null)
{
return $this->timestamp($column, $precision)->nullable();
}
Expand All @@ -1239,7 +1239,7 @@ public function softDeletes($column = 'deleted_at', $precision = 0)
* @param int|null $precision
* @return \Illuminate\Database\Schema\ColumnDefinition
*/
public function softDeletesTz($column = 'deleted_at', $precision = 0)
public function softDeletesTz($column = 'deleted_at', $precision = null)
{
return $this->timestampTz($column, $precision)->nullable();
}
Expand All @@ -1251,7 +1251,7 @@ public function softDeletesTz($column = 'deleted_at', $precision = 0)
* @param int|null $precision
* @return \Illuminate\Database\Schema\ColumnDefinition
*/
public function softDeletesDatetime($column = 'deleted_at', $precision = 0)
public function softDeletesDatetime($column = 'deleted_at', $precision = null)
{
return $this->datetime($column, $precision)->nullable();
}
Expand Down
16 changes: 8 additions & 8 deletions tests/Database/DatabasePostgresSchemaGrammarTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ public function testAddingDateTime()
$blueprint->dateTime('created_at');
$statements = $blueprint->toSql($this->getConnection(), $this->getGrammar());
$this->assertCount(1, $statements);
$this->assertSame('alter table "users" add column "created_at" timestamp(0) without time zone not null', $statements[0]);
$this->assertSame('alter table "users" add column "created_at" timestamp without time zone not null', $statements[0]);
}

public function testAddingDateTimeWithPrecision()
Expand All @@ -725,7 +725,7 @@ public function testAddingDateTimeTz()
$blueprint->dateTimeTz('created_at');
$statements = $blueprint->toSql($this->getConnection(), $this->getGrammar());
$this->assertCount(1, $statements);
$this->assertSame('alter table "users" add column "created_at" timestamp(0) with time zone not null', $statements[0]);
$this->assertSame('alter table "users" add column "created_at" timestamp with time zone not null', $statements[0]);
}

public function testAddingDateTimeTzWithPrecision()
Expand All @@ -752,7 +752,7 @@ public function testAddingTime()
$blueprint->time('created_at');
$statements = $blueprint->toSql($this->getConnection(), $this->getGrammar());
$this->assertCount(1, $statements);
$this->assertSame('alter table "users" add column "created_at" time(0) without time zone not null', $statements[0]);
$this->assertSame('alter table "users" add column "created_at" time without time zone not null', $statements[0]);
}

public function testAddingTimeWithPrecision()
Expand All @@ -779,7 +779,7 @@ public function testAddingTimeTz()
$blueprint->timeTz('created_at');
$statements = $blueprint->toSql($this->getConnection(), $this->getGrammar());
$this->assertCount(1, $statements);
$this->assertSame('alter table "users" add column "created_at" time(0) with time zone not null', $statements[0]);
$this->assertSame('alter table "users" add column "created_at" time with time zone not null', $statements[0]);
}

public function testAddingTimeTzWithPrecision()
Expand All @@ -806,7 +806,7 @@ public function testAddingTimestamp()
$blueprint->timestamp('created_at');
$statements = $blueprint->toSql($this->getConnection(), $this->getGrammar());
$this->assertCount(1, $statements);
$this->assertSame('alter table "users" add column "created_at" timestamp(0) without time zone not null', $statements[0]);
$this->assertSame('alter table "users" add column "created_at" timestamp without time zone not null', $statements[0]);
}

public function testAddingTimestampWithPrecision()
Expand All @@ -833,7 +833,7 @@ public function testAddingTimestampTz()
$blueprint->timestampTz('created_at');
$statements = $blueprint->toSql($this->getConnection(), $this->getGrammar());
$this->assertCount(1, $statements);
$this->assertSame('alter table "users" add column "created_at" timestamp(0) with time zone not null', $statements[0]);
$this->assertSame('alter table "users" add column "created_at" timestamp with time zone not null', $statements[0]);
}

public function testAddingTimestampTzWithPrecision()
Expand All @@ -860,7 +860,7 @@ public function testAddingTimestamps()
$blueprint->timestamps();
$statements = $blueprint->toSql($this->getConnection(), $this->getGrammar());
$this->assertCount(1, $statements);
$this->assertSame('alter table "users" add column "created_at" timestamp(0) without time zone null, add column "updated_at" timestamp(0) without time zone null', $statements[0]);
$this->assertSame('alter table "users" add column "created_at" timestamp without time zone null, add column "updated_at" timestamp without time zone null', $statements[0]);
}

public function testAddingTimestampsTz()
Expand All @@ -869,7 +869,7 @@ public function testAddingTimestampsTz()
$blueprint->timestampsTz();
$statements = $blueprint->toSql($this->getConnection(), $this->getGrammar());
$this->assertCount(1, $statements);
$this->assertSame('alter table "users" add column "created_at" timestamp(0) with time zone null, add column "updated_at" timestamp(0) with time zone null', $statements[0]);
$this->assertSame('alter table "users" add column "created_at" timestamp with time zone null, add column "updated_at" timestamp with time zone null', $statements[0]);
}

public function testAddingBinary()
Expand Down
4 changes: 2 additions & 2 deletions tests/Database/DatabaseSchemaBlueprintTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public function testDefaultCurrentDateTime()
$this->assertEquals(['alter table `users` add `created` datetime not null default CURRENT_TIMESTAMP'], $blueprint->toSql($connection, new MySqlGrammar));

$blueprint = clone $base;
$this->assertEquals(['alter table "users" add column "created" timestamp(0) without time zone not null default CURRENT_TIMESTAMP'], $blueprint->toSql($connection, new PostgresGrammar));
$this->assertEquals(['alter table "users" add column "created" timestamp without time zone not null default CURRENT_TIMESTAMP'], $blueprint->toSql($connection, new PostgresGrammar));

$blueprint = clone $base;
$this->assertEquals(['alter table "users" add column "created" datetime not null default CURRENT_TIMESTAMP'], $blueprint->toSql($connection, new SQLiteGrammar));
Expand All @@ -138,7 +138,7 @@ public function testDefaultCurrentTimestamp()
$this->assertEquals(['alter table `users` add `created` timestamp not null default CURRENT_TIMESTAMP'], $blueprint->toSql($connection, new MySqlGrammar));

$blueprint = clone $base;
$this->assertEquals(['alter table "users" add column "created" timestamp(0) without time zone not null default CURRENT_TIMESTAMP'], $blueprint->toSql($connection, new PostgresGrammar));
$this->assertEquals(['alter table "users" add column "created" timestamp without time zone not null default CURRENT_TIMESTAMP'], $blueprint->toSql($connection, new PostgresGrammar));

$blueprint = clone $base;
$this->assertEquals(['alter table "users" add column "created" datetime not null default CURRENT_TIMESTAMP'], $blueprint->toSql($connection, new SQLiteGrammar));
Expand Down