From 1a815e80919dccce0e26799f2ff1b0f8460fb4f3 Mon Sep 17 00:00:00 2001 From: Paulo Freitas Date: Wed, 8 Nov 2017 08:00:05 -0200 Subject: [PATCH] Improve temporal columns docblocks --- src/Illuminate/Database/Schema/Blueprint.php | 14 +++++------ .../Database/Schema/Grammars/MySqlGrammar.php | 8 ++++--- .../Schema/Grammars/PostgresGrammar.php | 8 ++++--- .../Schema/Grammars/SQLiteGrammar.php | 23 ++++++++++++++----- .../Schema/Grammars/SqlServerGrammar.php | 12 ++++++---- 5 files changed, 41 insertions(+), 24 deletions(-) diff --git a/src/Illuminate/Database/Schema/Blueprint.php b/src/Illuminate/Database/Schema/Blueprint.php index 359351cd5a47..2b0251a78320 100755 --- a/src/Illuminate/Database/Schema/Blueprint.php +++ b/src/Illuminate/Database/Schema/Blueprint.php @@ -784,7 +784,7 @@ public function dateTime($column, $precision = 0) } /** - * Create a new date-time column (with time zone) on the table. + * Create a new date-time (with time zone) column on the table. * * @param string $column * @param int $precision @@ -808,7 +808,7 @@ public function time($column, $precision = 0) } /** - * Create a new time column (with time zone) on the table. + * Create a new time (with time zone) column on the table. * * @param string $column * @param int $precision @@ -844,7 +844,7 @@ public function timestampTz($column, $precision = 0) } /** - * Add nullable creation and update timestamps to the table. + * Add nullable creation and update timestamps columns to the table. * * @param int $precision * @return void @@ -857,7 +857,7 @@ public function timestamps($precision = 0) } /** - * Add nullable creation and update timestamps to the table. + * Add nullable creation and update timestamps columns to the table. * * Alias for self::timestamps(). * @@ -870,7 +870,7 @@ public function nullableTimestamps($precision = 0) } /** - * Add creation and update timestampTz columns to the table. + * Add nullable creation and update timestamps (with time zone) columns to the table. * * @param int $precision * @return void @@ -883,7 +883,7 @@ public function timestampsTz($precision = 0) } /** - * Add a "deleted at" timestamp for the table. + * Add a nullable deletion timestamp column to the table. * * @param string $column * @param int $precision @@ -895,7 +895,7 @@ public function softDeletes($column = 'deleted_at', $precision = 0) } /** - * Add a "deleted at" timestampTz for the table. + * Add a nullable deletion timestamp (with time zone) column to the table. * * @param int $precision * @return \Illuminate\Support\Fluent diff --git a/src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php b/src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php index 9bcf4e7f5bbe..f9b5d847138c 100755 --- a/src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php +++ b/src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php @@ -602,7 +602,7 @@ protected function typeDateTime(Fluent $column) } /** - * Create the column definition for a date-time type. + * Create the column definition for a date-time (with time zone) type. * * @param \Illuminate\Support\Fluent $column * @return string @@ -626,7 +626,7 @@ protected function typeTime(Fluent $column) } /** - * Create the column definition for a time type. + * Create the column definition for a time (with time zone) type. * * @param \Illuminate\Support\Fluent $column * @return string @@ -650,7 +650,7 @@ protected function typeTimestamp(Fluent $column) } /** - * Create the column definition for a timestamp type. + * Create the column definition for a timestamp (with time zone) type. * * @param \Illuminate\Support\Fluent $column * @return string @@ -795,6 +795,8 @@ public function typeMultiPolygon(Fluent $column) /** * Parse the default value for a temporal column type. * + * @see https://dev.mysql.com/doc/refman/5.7/en/timestamp-initialization.html + * * @param \Illuminate\Support\Fluent $column * @return void */ diff --git a/src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php b/src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php index d6fd6317e5bc..6dc12456831d 100755 --- a/src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php +++ b/src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php @@ -551,7 +551,7 @@ protected function typeDateTime(Fluent $column) } /** - * Create the column definition for a date-time type. + * Create the column definition for a date-time (with time zone) type. * * @param \Illuminate\Support\Fluent $column * @return string @@ -575,7 +575,7 @@ protected function typeTime(Fluent $column) } /** - * Create the column definition for a time type. + * Create the column definition for a time (with time zone) type. * * @param \Illuminate\Support\Fluent $column * @return string @@ -601,7 +601,7 @@ protected function typeTimestamp(Fluent $column) } /** - * Create the column definition for a timestamp type. + * Create the column definition for a timestamp (with time zone) type. * * @param \Illuminate\Support\Fluent $column * @return string @@ -759,6 +759,8 @@ private function formatPostGisType(string $type) /** * Parse the default value for a temporal column type. * + * @see https://www.postgresql.org/docs/10/static/functions-datetime.html#functions-datetime-current + * * @param \Illuminate\Support\Fluent $column * @return void */ diff --git a/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php b/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php index 9087bbc51a1f..87830f9d46fa 100755 --- a/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php +++ b/src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php @@ -551,6 +551,10 @@ protected function typeDate(Fluent $column) /** * Create the column definition for a date-time type. * + * Note: SQLite does not have a storage class set aside for storing dates and/or times. + * + * @see https://www.sqlite.org/datatype3.html + * * @param \Illuminate\Support\Fluent $column * @return string */ @@ -562,10 +566,7 @@ protected function typeDateTime(Fluent $column) } /** - * Create the column definition for a date-time type. - * - * Note: "SQLite does not have a storage class set aside for storing dates and/or times." - * @link https://www.sqlite.org/datatype3.html + * Create the column definition for a date-time (with time zone) type. * * @param \Illuminate\Support\Fluent $column * @return string @@ -578,6 +579,10 @@ protected function typeDateTimeTz(Fluent $column) /** * Create the column definition for a time type. * + * Note: SQLite does not have a storage class set aside for storing dates and/or times. + * + * @see https://www.sqlite.org/datatype3.html + * * @param \Illuminate\Support\Fluent $column * @return string */ @@ -589,7 +594,7 @@ protected function typeTime(Fluent $column) } /** - * Create the column definition for a time type. + * Create the column definition for a time (with time zone) type. * * @param \Illuminate\Support\Fluent $column * @return string @@ -602,6 +607,10 @@ protected function typeTimeTz(Fluent $column) /** * Create the column definition for a timestamp type. * + * Note: SQLite does not have a storage class set aside for storing dates and/or times. + * + * @see https://www.sqlite.org/datatype3.html + * * @param \Illuminate\Support\Fluent $column * @return string */ @@ -611,7 +620,7 @@ protected function typeTimestamp(Fluent $column) } /** - * Create the column definition for a timestamp type. + * Create the column definition for a timestamp (with time zone) type. * * @param \Illuminate\Support\Fluent $column * @return string @@ -756,6 +765,8 @@ public function typeMultiPolygon(Fluent $column) /** * Parse the default value for a temporal column type. * + * @see https://www.sqlite.org/lang_createtable.html#tablecoldef + * * @param \Illuminate\Support\Fluent $column * @return void */ diff --git a/src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php b/src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php index 0744320f0685..33579dc07d52 100755 --- a/src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php +++ b/src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php @@ -494,6 +494,8 @@ protected function typeDate(Fluent $column) /** * Create the column definition for a date-time type. * + * Note: DATETIME is being used in place of DATETIME2(0) for SQL Server 2005 compatibility + * * @param \Illuminate\Support\Fluent $column * @return string */ @@ -505,7 +507,7 @@ protected function typeDateTime(Fluent $column) } /** - * Create the column definition for a date-time type. + * Create the column definition for a date-time (with time zone) type. * * @param \Illuminate\Support\Fluent $column * @return string @@ -531,7 +533,7 @@ protected function typeTime(Fluent $column) } /** - * Create the column definition for a time type. + * Create the column definition for a time (with time zone) type. * * @param \Illuminate\Support\Fluent $column * @return string @@ -553,9 +555,7 @@ protected function typeTimestamp(Fluent $column) } /** - * Create the column definition for a timestamp type. - * - * @link https://msdn.microsoft.com/en-us/library/bb630289(v=sql.120).aspx + * Create the column definition for a timestamp (with time zone) type. * * @param \Illuminate\Support\Fluent $column * @return string @@ -700,6 +700,8 @@ public function typeMultiPolygon(Fluent $column) /** * Parse the default value for a temporal column type. * + * @see https://docs.microsoft.com/en-us/sql/t-sql/statements/create-table-transact-sql#default-definitions + * * @param \Illuminate\Support\Fluent $column * @return void */