It seems strange to me, that creation of model, running migration, destroying it, and creating again same model reports SQL exception:
project|master ⇒ rails g m
rails d model name
This just deletes the model and not the migration you have run (which created the table in the database).
If you want to delete both the model and the tables, you will have to do the following
rake db:rollback
rails d model name
You deleted the model–that's a different operation than rolling back a migration.
Destroying a model does precisely, and only, that; it has nothing to do with migrations.
according to your migration error there must be something wrong with the migration files, moreover the one which referring to create names table.
please look at this file, at your change method.
the change method in a migration file is supposed to execute a DB code, that DB code can do some operations on the DB, and that same code on the change supposed to be right to do the rolling back.
if you want to separate between the two you should put the code on the up method which will perform operations on the DB, and on the down method the opposite rolling operations.
i would suggest that you delete all the files on the migration including the one that cause the problem, and write them correct.
if you need help please post your migration file.
please also take a look at the guides: http://guides.rubyonrails.org/migrations.html