AmurSU / taurus

System for composing the timetable for Amur State University
taurus.amursu.ru
2 stars 0 forks source link

ругается на hstore #5

Open artb1sh opened 11 years ago

artb1sh commented 11 years ago

Даже не знаю что дальше делать. В чем может быть дело? Версия postgres может нужна особенная? У меня 8.4.13(PS наверно старая версия у меня?)

rake db:setup --trace

* Invoke db:setup (first_time) * Invoke db:schema:load_if_ruby (first_time) * Invoke db:create (first_time) * Invoke db:load_config (first_time) * Execute db:load_config * Invoke rails_env (first_time) * Execute rails_env * Execute db:create * Invoke environment (first_time) * Execute environment * Execute db:schema:load_if_ruby * Invoke db:schema:load (first_time) * Invoke environment * Invoke db:load_config \ Execute db:schema:load -- create_table("buildings", {:force=>true}) NOTICE: CREATE TABLE will create implicit sequence "buildings_id_seq" for serial column "buildings.id" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "buildings_pkey" for table "buildings" -> 0.0837s -- create_table("charge_cards", {:force=>true}) NOTICE: CREATE TABLE will create implicit sequence "charge_cards_id_seq" for serial column "charge_cards.id" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "charge_cards_pkey" for table "charge_cards" -> 0.0938s -- create_table("charge_cards_preferred_classrooms", {:id=>false, :force=>true}) -> 0.0093s -- create_table("classrooms", {:force=>true}) NOTICE: CREATE TABLE will create implicit sequence "classrooms_id_seq" for serial column "classrooms.id" rake aborted! PG::Error: ERROR: type "hstore" does not exist LINE 1: ...T 'f', "title" character varying(255), "properties" hstore) ^ : CREATE TABLE "classrooms" ("id" serial primary key, "building_id" integer, "department_id" integer, "name" character varying(255), "created_at" timestamp, "updated_at" timestamp, "capacity" integer, "department_lock" boolean DEFAULT 'f', "title" character varying(255), "properties" hstore)

Envek commented 11 years ago

hstore — это специальный тип данных в PostgreSQL и с недавних пор используется для хранения вспомогательных данных об аудиториях. Подробнее здесь: http://blog.remarkablelabs.com/2012/12/a-love-affair-with-postgresql-rails-4-countdown-to-2013

Для того, чтобы использовать данный тип необходимо выполнить SQL-команду CREATE EXTENSION hstore; на целевой базе данных (возможно потребуется установить пакет postgresql-contrib).

Для того, чтобы включить hstore для всех вновь создаваемых баз данных в Ubuntu Linux:

sudo apt-get install postgresql-contrib
sudo -u postgres psql template1 -c "CREATE EXTENSION hstore;"

После чего выполните:

rake db:drop
rake db:setup

Каюсь — это ещё не документировано. Нужно просто сменить тип хранения схемы БД из формата ruby-кода в SQL-формат.

artb1sh commented 11 years ago

Спасибо, помогло. А посмотрите ещё раз пожалуйста, опять на чем-то застопорилось:

]# rake db:setup --trace * Invoke db:setup (first_time) * Invoke db:schema:load_if_ruby (first_time) * Invoke db:create (first_time) * Invoke db:load_config (first_time) * Execute db:load_config * Invoke rails_env (first_time) * Execute rails_env * Execute db:create taurus6_development already exists taurus6_test already exists * Invoke environment (first_time) * Execute environment * Execute db:schema:load_if_ruby * Invoke db:schema:load (first_time) * Invoke environment * Invoke db:load_config * Execute db:schema:load -- create_table("buildings", {:force=>true}) NOTICE: CREATE TABLE will create implicit sequence "buildings_id_seq" for serial column "buildings.id" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "buildings_pkey" for table "buildings" -> 0.1325s -- create_table("charge_cards", {:force=>true}) NOTICE: CREATE TABLE will create implicit sequence "charge_cards_id_seq" for serial column "charge_cards.id" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "charge_cards_pkey" for table "charge_cards" -> 0.1137s -- create_table("charge_cards_preferred_classrooms", {:id=>false, :force=>true}) -> 0.0593s -- create_table("classrooms", {:force=>true}) NOTICE: CREATE TABLE will create implicit sequence "classrooms_id_seq" for serial column "classrooms.id" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "classrooms_pkey" for table "classrooms" -> 0.1358s -- create_table("departments", {:force=>true}) NOTICE: CREATE TABLE will create implicit sequence "departments_id_seq" for serial column "departments.id" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "departments_pkey" for table "departments" -> 0.0771s -- create_table("departments_users", {:id=>false, :force=>true}) -> 0.0279s -- create_table("disciplines", {:force=>true}) NOTICE: CREATE TABLE will create implicit sequence "disciplines_id_seq" for serial column "disciplines.id" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "disciplines_pkey" for table "disciplines" -> 0.0146s -- create_table("faculties", {:force=>true}) NOTICE: CREATE TABLE will create implicit sequence "faculties_id_seq" for serial column "faculties.id" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "faculties_pkey" for table "faculties" -> 0.0296s -- create_table("groups", {:force=>true}) NOTICE: CREATE TABLE will create implicit sequence "groups_id_seq" for serial column "groups.id" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "groups_pkey" for table "groups" -> 0.0081s -- create_table("jets", {:force=>true}) NOTICE: CREATE TABLE will create implicit sequence "jets_id_seq" for serial column "jets.id" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "jets_pkey" for table "jets" -> 0.0087s -- create_table("lecturers", {:force=>true}) NOTICE: CREATE TABLE will create implicit sequence "lecturers_id_seq" for serial column "lecturers.id" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "lecturers_pkey" for table "lecturers" -> 0.0122s -- create_table("lesson_types", {:force=>true}) NOTICE: CREATE TABLE will create implicit sequence "lesson_types_id_seq" for serial column "lesson_types.id" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "lesson_types_pkey" for table "lesson_types" -> 0.0246s -- create_table("pairs", {:force=>true}) NOTICE: CREATE TABLE will create implicit sequence "pairs_id_seq" for serial column "pairs.id" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pairs_pkey" for table "pairs" -> 0.0828s -- create_table("positions", {:force=>true}) NOTICE: CREATE TABLE will create implicit sequence "positions_id_seq" for serial column "positions.id" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "positions_pkey" for table "positions" -> 0.1621s -- create_table("semesters", {:force=>true}) NOTICE: CREATE TABLE will create implicit sequence "semesters_id_seq" for serial column "semesters.id" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "semesters_pkey" for table "semesters" -> 0.0903s -- add_index("semesters", ["year", "number", "full_time"], {:name=>"index_semesters_on_year_and_number_and_full_time", :unique=>true}) -> 0.0784s -- create_table("sessions", {:force=>true}) NOTICE: CREATE TABLE will create implicit sequence "sessions_id_seq" for serial column "sessions.id" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "sessions_pkey" for table "sessions" -> 0.1054s -- add_index("sessions", ["session_id"], {:name=>"index_sessions_on_session_id"}) -> 0.0784s -- add_index("sessions", ["updated_at"], {:name=>"index_sessions_on_updated_at"}) -> 0.0708s -- create_table("specialities", {:force=>true}) NOTICE: CREATE TABLE will create implicit sequence "specialities_id_seq" for serial column "specialities.id" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "specialities_pkey" for table "specialities" -> 0.0485s -- create_table("subgroups", {:force=>true}) NOTICE: CREATE TABLE will create implicit sequence "subgroups_id_seq" for serial column "subgroups.id" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "subgroups_pkey" for table "subgroups" -> 0.0102s -- create_table("teaching_places", {:force=>true}) NOTICE: CREATE TABLE will create implicit sequence "teaching_places_id_seq" for serial column "teaching_places.id" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "teaching_places_pkey" for table "teaching_places" -> 0.0782s -- create_table("teaching_plans", {:force=>true}) NOTICE: CREATE TABLE will create implicit sequence "teaching_plans_id_seq" for serial column "teaching_plans.id" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "teaching_plans_pkey" for table "teaching_plans" -> 0.0617s -- create_table("users", {:force=>true}) NOTICE: CREATE TABLE will create implicit sequence "users_id_seq" for serial column "users.id" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "users_pkey" for table "users" -> 0.0923s -- add_index("users", ["email"], {:name=>"index_users_on_email", :unique=>true}) -> 0.0834s -- add_index("users", ["login"], {:name=>"index_users_on_login", :unique=>true}) -> 0.0398s -- add_index("users", ["reset_password_token"], {:name=>"index_users_on_reset_password_token", :unique=>true}) -> 0.0616s -- initialize_schema_migrations_table() -> 0.0007s -- assume_migrated_upto_version(20130130014707, ["/srv/taurus/db/migrate"]) -> 0.0009s * Invoke db:structure:load_if_sql (first_time) * Invoke db:create * Invoke environment * Execute db:structure:load_if_sql * Invoke db:seed (first_time) * Execute db:seed * Invoke db:abort_if_pending_migrations (first_time) * Invoke environment * Invoke db:load_config \ Execute db:abort_if_pending_migrations rake aborted! undefined method create' for Admin:Module /srv/taurus/db/seeds.rb:27:in<top (required)>'

artb1sh commented 11 years ago

Благодарю! Всё заработало.

artb1sh commented 11 years ago

Apache с модулем Passenger всё ругается: PG::Error: ERROR: relation "users" does not exist LINE 5: WHERE a.attrelid = '"users"'::regclass ^ : SELECT a.attname, format_type(a.atttypid, a.atttypmod), pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum WHERE a.attrelid = '"users"'::regclass AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum (ActiveRecord::StatementInvalid)

А если запустить через rails server - всё нормально.

Непонятно ничего.

artb1sh commented 11 years ago

только с RailsEnv development заработало

Envek commented 11 years ago

Смотрите config/database.yml. Скорее всего для production указана неверная база данных. 18.04.2013 2:57 пользователь "artb1sh" notifications@github.com написал:

только с RailsEnv development заработало

— Reply to this email directly or view it on GitHubhttps://github.com/AmurSU/taurus/issues/5#issuecomment-16518464 .