drewster
drewster

Reputation: 6130

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.

Upvotes: 1

Views: 715

Answers (1)

Nick
Nick

Reputation: 5200

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';

Upvotes: 5

Related Questions