ear*_*son 9 ruby postgresql json ruby-on-rails
我最近克隆了一个项目到我的本地Ubuntu框,因为我是远程的,并且在rake db migrate上,我收到以下错误:
PG::UndefinedObject: ERROR: type "json" does not exist
Run Code Online (Sandbox Code Playgroud)
我表中的几列是:
add_column :table, :column, :json
Run Code Online (Sandbox Code Playgroud)
此迁移适用于Mac上的工作,但不在此处.我已经尝试升级到PostgreSQL 9.3.4,但问题仍然存在.我也试过sudo apt-get upgrade postgresql,但问题仍然存在.
Ruby版本是2.1.0 Rails版本是4.0.3
Cra*_*ger 19
我已经尝试升级到PostgreSQL 9.3.4,但问题仍然存在
很可能你仍然连接到旧版本.试试SELECT version()
.
既然你提到apt-get
你大概是在Debian或Ubuntu上.这些用于pg_wrapper
允许多个PostgreSQL并行安装.每个人都有一个不同的端口号.第一次安装获取默认端口5432.后续安装获得更高端口.
您可以使用查看安装pg_lsclusters
.您的9.3安装很可能是在端口9433上,您需要更改database.yml
(因为您使用Rails)连接到该端口.
如果由于任何原因您遇到此问题,您的9.3版本实际上并未运行.
我发现此链接非常有用:
http://nixmash.com/postgresql/upgrading-postgresql-9-1-to-9-3-in-ubuntu/
我从命令开始:
sudo service postgresql stop
Run Code Online (Sandbox Code Playgroud)
并从那里运行所有命令.现在一切都很好.