Project

General

Profile

Redmine does not generate db/schema.rb

Added by Alexey Lustin over 15 years ago

i have install a new Redmine installation (r2744)
after install all the gem i have migrate db and load default data

all perfect throw this moment

then i have decided install the plugin - Budget and Rate

in my script to reload mongrel used db:migrate:all
and i have the error

 rake db:migrate:all RAILS_ENV="production" --trace
(in /home/virtwww/w_lustin_e3572841/http)
** Invoke db:migrate:all (first_time)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
rake aborted!
PGError: ERROR:  relation "schema_migrations" already exists
: CREATE TABLE "schema_migrations" ("version" character varying(255) NOT NULL)
...

WHY THE FIRST TIME ? i think

then i use the psql

 select count(version) from schema_migrations;
 count
-------
   116
(1 row)

the value in last row - version=20090503121510

ok, i think and the run

RAILS_ENV=production script/about

About your application's environment
Ruby version              1.8.6 (x86_64-linux)
RubyGems version          1.3.1
Rails version             2.2.2
Active Record version     2.2.2
Action Pack version       2.2.2
Active Resource version   2.2.2
Action Mailer version     2.2.2
Active Support version    2.2.2
Application root          /home/virtwww/w_lustin_e3572841/http
Environment               production
Database adapter          postgresql
Database schema version   0

i dont now, why database version is 0

when i decided to force schema generation and run
rake db:schema:dump RAILS_ENV="production" --trace

nothing changes

cat db/schema.rb
# This file is auto-generated from the current state of the database. Instead of editing this file,
# please use the migrations feature of Active Record to incrementally modify your database, and
# then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your database schema. If you need
# to create the application database on another system, you should be using db:schema:load, not running
# all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended to check this file into your version control system.

ActiveRecord::Schema.define(:version => 0) do

end


anybody know where is My error

Redmine is working, i have create 3 projects and 5 users.

But, i nave have no ability to migration.


Replies (2)

RE: Redmine does not generate db/schema.rb - Added by Alexey Lustin over 15 years ago

only one change between my development local release and in production Redmine

the Postgres database has NOT public scheme

database parametrs


may be that is reason of my error...

RE: Redmine does not generate db/schema.rb - Added by Alexey Lustin over 15 years ago

i have wins this problem

if the database in Postgres is not public, then you have to use another parameter in database.yml
and it is schema_search_path:

template looks like this

production:
  adapter: postgresql
  database: <your_database_name>
  host: <postgres_host>
  username: <postgres_user>
  passord: <postgres_user_password>
  encoding: utf8
  schema_search_path: <database_schema> (default - public)

in the FAQ i think

    (1-2/2)