![]() |
Migration and refresh problems - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Migration and refresh problems (/showthread.php?tid=87633) |
Migration and refresh problems - sdiri - 05-11-2023 Hi there, I'm sorry for any grammatical errors in my message. I hope you can help me with an issue I'm having in CodeIgniter 4. Until now, I've been using the classic method to create databases, but I've recently started using migration and forge classes, and I'm having some problems/questions. In my project, I have almost 10 migration files. When I run Code: php spark migrate or Code: php spark migrate --all Code: php spark migrate:refresh , everything works fine except for one migration file. It gives me an error message saying that the usersexperiences table already exists, which is not true . I have deleted this table from the database and tried again, but I still get the same error message in my terminal. I have also deleted both, the table and the field in my migration table in the database that indicate the class namespace and tried again, but I'm still getting the same error message. All the other migrations pass except for this one "he create the table but always with table exist error!" . I added true as agrs in create createTable method and dropTable method but still the same error. unfortunatly this boolean argument not longer supported and deprecated. this my migration class : PHP Code: <?php ![]() Question: Why do I get an error saying the table does not exist when I changed the table name from usersexperiences to usersexp ? Additional Questions: How do I add new fields to a table using migrations? Can migrations help me keep versions of the database, tables, and fields and rollback when needed? Any help you can provide would be greatly appreciated. Thank you. RE: Migration and refresh problems - kenjis - 05-11-2023 > How do I add new fields to a table using migrations? See https://codeigniter4.github.io/CodeIgniter4/dbmgmt/forge.html#adding-a-field-to-a-table RE: Migration and refresh problems - luckmoshy - 05-12-2023 Because the batch number is still presented in migration table you should do by following batch number PHP Code: php spark migrate:rollback - 5 as hrere https://codeigniter4.github.io/CodeIgniter4/dbmgmt/migration.html?highlight=migration#rollback find your batch https://codeigniter4.github.io/CodeIgniter4/dbmgmt/migration.html?highlight=migration#status |