Answer the question
In order to leave comments, you need to log in
How to automatically generate table schema in Yii2/migrate?
Can you please tell me how to automatically generate the following code:
$this->createTable('{{%users}}', [
'id' => Schema::TYPE_PK,
'username' => Schema::TYPE_STRING . '(25) NOT NULL',
'email' => Schema::TYPE_STRING . '(255) NOT NULL',
], $tableOptions);
yii migrate/create users table_name
ALTER TABLE `users`
ADD CONSTRAINT `users_news` FOREIGN KEY (`user_ID`) REFERENCES `users` (`ID`) ON DELETE NO ACTION ON UPDATE NO ACTION;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question