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