-
-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[2.1] Proposal for handling primary keys in migrations. #10
Comments
Yes. Good idea. |
No break BC if only add primaryKey() method. |
I prepared two PR's. One for 2.0 with bc compatibility as suggested by @mdmunir and one for 2.1 with BC Break. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently the class
yii\db\Migration
has a methodsprimaryKey()
andbigPrimaryKey()
which create a column based onSchema::TYPE_PK
orSchema::TYPE_BIGPK
respectively.I propose to move the
primaryKey()
method to theyii\db\ColumnSchemaBuilder
class as a column modifier with the signature.Usage
And for mixed primary keys I propose to create a new method.
yii\db\Migration::tablePrimaryKey()
(the name can be different) with signature.Usage
the
...$column
syntax is available since php5.6 but we can use simple arrays instead. If you don't like the method nametablePrimaryKey()
please propose something else in comments.The text was updated successfully, but these errors were encountered: