只是試圖在ubuntu上設置Rails應用程序來做一些低級別的開發工作,而沒有經歷打擾我們主要開發人員的麻煩。然而,在這個過程的最後,我運行rails s命令。我在localhost:3000上登陸頁面,並且可以在不直接調用數據庫的情況下瀏覽頁面。然而,當我去到從數據庫獲取數據的任何頁面,它給了我以下錯誤:在localhost上設置Rails項目,postgresql問題
ActiveRecord::StatementInvalid in WantsController#new
PG::Error: ERROR: relation "geometry_columns" does not exist
LINE 1: SELECT * FROM geometry_columns WHERE f_table_name='wants'
^
: SELECT * FROM geometry_columns WHERE f_table_name='wants'
現在,不知道我做錯了。下面是我採取的步驟:
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" >> /etc/apt/sources.list'
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-9.3-postgis pgadmin3 postgresql-contrib postgresql-server-dev-9.3
sudo -u postgres psql
postgres=# CREATE EXTENSION adminpack;
postgres=# CREATE EXTENSION postgis;
postgres=# \q
postgres=# CREATE USER abc WITH PASSWORD 'abc';
postgres=# CREATE DATABASE abc;
postgres=# CREATE DATABASE abc_development;
pg_restore --verbose --clean --no-acl --no-owner -h localhost -U abc -d abc abc-20131217-09.pgdmp
pg_restore --verbose --clean --no-acl --no-owner -h localhost -U abc -d abc_development abc_development-20131217-09.pgdmp
然後導航到克隆git的文件夾,並執行捆綁和軌道小號
這裏的database.yml中:
development: &dev
# adapter: postgresql
database: abc_development
username: abc
password: abc
host: localhost
encoding: utf8
postgis_extension: true
schema_search_path: public,postgis
adapter: postgis
encoding: utf8
postgis_extension: postgis
production:
adapter: postgis
database: abc
username: abc
password: oTSZ1gQdwsFXWIUZsehj
host: localhost
encoding: utf8
postgis_extension: true
schema_search_path: public,postgis
postgis_extension: postgis
任何想法它在哪裏出錯了?幫助將不勝感激。
沒有骰子。有一堆的遷移文件(git克隆來自一個完全正常工作的網站,所以數據庫轉儲),其中包括一個應該創建geometry_columns但運行rake db的遷移文件:將其遷移回 rake中止! PG ::錯誤:錯誤:關係 「GEOMETRY_COLUMNS」 不存在 LINE 1:SELECT * FROM GEOMETRY_COLUMNS WHERE f_table_name = 'schema_mi ... ^ :SELECT * FROM GEOMETRY_COLUMNS WHERE f_table_name =' schema_migrations' 任何想法,然後?我哪裏出錯了? – user3276029