Yii Framework Forum: Yii2 Database Migration - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Yii2 Database Migration

#1 User is offline   carn4ge 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 63
  • Joined: 04-January 17

Posted 13 March 2018 - 04:15 AM

I already created and imported my database schema on phpmyadmin, then after installing Yii2 Advanced App I've tried migrating and it says "user table already exists". Is it really necessary to use migrate database or not?
0

#2 User is online   jim. 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 181
  • Joined: 28-June 12
  • Location:Germany

Posted 13 March 2018 - 06:04 AM

No, it is not neccessary if all tables and columns are already there.

If you want to run the migration but donĀ“t want to get that error you could check if the table is already there and skip the createtable in Up():

if ($this->db->schema->getTableSchema('{{%nameofthetable}}', true) = null) {  // if table does not exist...

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users