简体   繁体   中英

Force Fluent migration to re-create dropped table — Using Fluent with Vapor 3 iOS Swift MySQL

I'm using Vapor 3 for some server-side Swift, with the Fluent add-in for handling database/model management, with MySQL underneath.

I'm working in development and wanted to force the migrator to recreate a table, so I went into mysql on the command line and did:

mysql> drop table SomeTableName;

However, re-running, the migration doesn't re-create the table. It has a zillion columns and lots of constraints, so I don't really want to do it manually.

If you look in the table called fluent in your database you will see a record with the name of the table. Delete this record and vapor will re-create the table the next time you run the app.

Like this:

mysql> drop table SomeTableName;
mysql> delete from fluent where name ='SomeTableName';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM