-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
problem with new migration 2.0.6 #6
Comments
primaryKey() method is a predefined format of a primary key in form of an auto incremental integer. if you need another form of primarykey you currently can not use the columnschemabuilder for it. |
@cebe of course for this i make this issue for make a enhacement for the version 2.0.7 |
I don't think it's possible w/o breaking compatibility. |
@samdark i know , but this limite the creator table, not all table work using integer and primary key |
my suggestion is in the primary key define the type data, and if is autoincrement adding parameters |
@spiritdead, I think that your case isn't reason for enhancement. There are can be many other unique migration cases. Core team can't cover all custom cases. Don't use columnschemabuilder for your case. Use custom definition for your PK column. Is it problem for you? |
@rugabarbo the standard PK is integer and string, i don't say other type of data, and the autoincrement is adding a parameter in the function primaryKey(), or you will limite this only autoincrement ? and i show the default sample creating a migration for the table Sessions (this table is default in the core yii2 and this use String PK) |
👍 'id' => $this->primaryKey(), // --> 'id' => Schema::TYPE_PK
'user_id' => $this->integer()->primaryKey(), // --> 'user_id' => Schema::TYPE_INTEGER . ' PRIMARY KEY'
|
The issue related with And this should be solved there |
hi all im trying this
'id' => Schema::TYPE_STRING . '(64) PRIMARY KEY',
but in the new migration i cant make this
'id' => $this->string(64)->primaryKey();
is a bug or this not exist in this case i cant define string to primary key ?
my suggestion is modify the primary key for support int and strings
$this->string()->primaryKey()->autoincrement(false);
or
$this->string->primaryKey($autoincrement = false);
i need this for the table sessions in this case
in this case i don't need autoincrement,etc and the string is primary key
The text was updated successfully, but these errors were encountered: