Skip to content

Commit 822ec20

Browse files
authored
Fix docs incorrectly stating primary keys default to unsigned (#1015)
* Fix docs incorrectly stating primary keys default to unsigned The documentation claimed primary keys are unsigned by default, but the actual code defaults to signed. Unsigned primary keys require either passing 'signed' => false or enabling the Migrations.unsigned_primary_keys feature flag. * Mention unsigned_ints flag alongside unsigned_primary_keys Both flags should be used together so foreign key columns match the unsigned primary keys they reference.
1 parent e8d7b84 commit 822ec20

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

docs/en/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -841,6 +841,8 @@ pass them to the method::
841841
// This one with the "default" connection
842842
$migrate = $migrations->migrate(['connection' => 'default']);
843843

844+
.. _feature-flags:
845+
844846
Feature Flags
845847
=============
846848

docs/en/writing-migrations.rst

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -549,13 +549,16 @@ comment MySQL, Postgres set a text comment on the table
549549
collation MySQL, SqlServer set the table collation *(defaults to database collation)*
550550
row_format MySQL set the table row format
551551
engine MySQL define table engine *(defaults to ``InnoDB``)*
552-
signed MySQL whether the primary key is ``signed`` *(defaults to ``false``)*
552+
signed MySQL whether the primary key is ``signed`` *(defaults to ``true``)*
553553
limit MySQL set the maximum length for the primary key
554554
========== ================ ===========
555555

556-
By default, the primary key is ``unsigned``.
557-
To simply set it to be signed just pass ``signed`` option with a ``true``
558-
value::
556+
By default, the primary key is ``signed``.
557+
To set it to be unsigned, pass the ``signed`` option with a ``false``
558+
value, or enable the ``Migrations.unsigned_primary_keys`` and
559+
``Migrations.unsigned_ints`` feature flags (see :ref:`feature-flags`).
560+
Both flags should be used together so that foreign key columns match
561+
the primary keys they reference::
559562

560563
<?php
561564

0 commit comments

Comments
 (0)