rake db:migrate 什么都不做 [英] rake db:migrate does nothing

查看:42
本文介绍了rake db:migrate 什么都不做的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在关注这个教程,我在运行 rake db:migrate

I'm following this tutorial, and I'm having a problem when running rake db:migrate

db/migrate 我有 create_post.rb 文件:

class CreatePosts < ActiveRecord::Migration
  def change
    create_table :posts do |t|
      t.string :title
      t.text :text
      t.timestamps
    end
  end
end

但它不会创建表.我的 database.yml 文件是:

But it does not create the table. My database.yml file is:

development:
 adapter: mysql2
 encoding: utf8
 database: blog_development
 pool: 5
 username: root
 password:
 socket: /tmp/mysql.sock

rake db:migrate 的输出似乎没问题.

The output from rake db:migrate seems ok.

我正在使用 phpMyAdmin 来处理我手动正确创建的数据库.

I'm using phpMyAdmin to handle the database, which is correctly created manually by me.

我做错了什么?

推荐答案

如果您连接到正确的数据库,我觉得一切都很好.. 几周前我遇到了类似的问题,并且接受了 这个 问题解决了我的问题.

If you are connecting to the right database everything seems fine to me.. I had a similar problem a few weeks ago and the accepted answer of this question fixed my issue.

以下是运行步骤:

rake db:drop:all
rake db:create:all
rake db:migrate

希望它能解决您的问题.

I hope it will fix your problem.

警告:这会清除您的数据库.

这篇关于rake db:migrate 什么都不做的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆