Rails is a cross-platform model-view-controller-centric application framework for Ruby. Use this tag for database-related Rails questions.
Questions tagged [rails]
46 questions
10
votes
2 answers
MySQL create index with LOCK=NONE still locks a table
I have the following MySQL RoR Migrations:
class ReindexRpushNotification < ActiveRecord::Migration
def up
execute("DROP INDEX `index_rpush_notifications_multi` ON rpush_notifications;")
execute("ALTER TABLE rpush_notifications ADD INDEX…
Rubycon
- 361
- 1
- 2
- 10
6
votes
1 answer
PostgreSQL 9.3 Amazon RDS gives error while using UUID-OSSP extension for generating uuid
I have created DB instance on RDS and used below function. It gave error while with the same PostgreSQL version on a local development machine it works fine.
create or replace function uuid() returns uuid as 'uuid-ossp', 'uuid_generate_v1' volatile…
Rameshwar RV
- 161
- 1
- 5
5
votes
1 answer
How to convert time without time zone to timestamp without time zone in PostgreSQL?
I received this error when trying to alter a column of type time to type timestamp:
PG::CannotCoerce: ERROR: cannot cast type time without time zone to timestamp without time zone
It's not important to me how the existing times are converted, but…
at.
- 167
- 1
- 1
- 3
4
votes
1 answer
What can I do to monitor "out of shared memory" issues?
I'm new to database administration and I would really like some advice on what tools I could use or what I could do to monitor "out of shared memory" issues.
I've been seeing these "out of shared memory" messages when I've been running rspec which…
alexia
- 51
- 3
4
votes
2 answers
MySQL: How to decrease sleep process's time out?
When I run 'show processlist;', then I get so many sleep processes.
I set wait_timeout and interactive_timeout to 60 in my.cnf. But, sleep process is not died when time 60 on processlist. I found that sleep process is died when time is 7900. What…
WitchOfCloud
- 41
- 1
- 1
- 3
4
votes
1 answer
Inventory management in Rails
I'm creating a inventory management app in rails. I have an User Table and a Recipe table, there is also some tables with types of material (pens, sharpies, paper, and so on). Because there is a lot of types of paper, pens and other things, and…
3
votes
2 answers
Efficient schema to handle time interval queries on a huge table?
We have huge table (+10 millions rows) where we aggregate the values by a using a time interval search on a Datetime column. And right now, to build single page on our app, we are querying this table several times, resulting in a high delay on our…
Peoplee
- 135
- 5
2
votes
1 answer
Copying database to different hard disk
Total noob at database administration here, excuse my ignorance.
I have a server running a Rails application that's using PostgreSQL. The database is saved on drive /z/, which seems to have filled up. I want to put a higher capacity drive and shift…
Achint
- 121
- 2
2
votes
2 answers
Set search path for Postgres in a Rails app
I have a project in heroku. I have the URI that enables me to connect with the database in my external rails app. How do I change or set the search path in ruby code?
Dan Dunclace
- 23
- 1
- 3
2
votes
3 answers
How to store short stories for access to individual sentences?
I am designing a database for the first time ever (using PostgreSQL), and am wondering about the most efficient/logical way of storing a body of text (aka, a story).
The conflict stems from the fact that the user will access text bodies in two…
michaelsking1993
- 173
- 7
2
votes
1 answer
In Rails: How is existing data affected by data type change?
I'm working on a Rails app and would like to change the datatype for an existing column. It's currently a DateTime type, and I want to change it to a Date type. I found a way to do this here, but in this case, the person was not worried about…
tinezekis
- 41
- 1
- 7
2
votes
1 answer
PostgreSQL: restore a record from a backup
We have a Rails app backed by a PostgreSQL DB and hosted on Heroku.
We recently had a bug that deleted some (very few before we caught it) records.
Excuse my ignorance but is there a straightforward way to directly pull a record (or 3) off of a…
Meltemi
- 777
- 3
- 9
- 14
1
vote
0 answers
On Heroku in production, how can I copy database A to database B on command?
From my local terminal, I can use the following commands to do what I need to do:
heroku pgbackups:capture --expire
heroku pgbackups:restore charcoal --confirm max-kiosk
However, I want to do this from the controller of my rails app, when the…
user2168130
- 111
- 1
1
vote
1 answer
Can’t connect to local PostgresSQL server
I have the Postres app installed an running on my Mac. And it has worked beautifully. I don’t know what changed, but now I cannot connect to it from Rails, PG Commander, PG Admin or the command psql -h localhost. However, I can connect with just…
David Beck
- 111
- 5
1
vote
1 answer
Why add indexes to these columns in the Database?
I am trying to get my head around this code. It's from the Rails Tutorial Book and is part of the process of making a twitter like application.
class CreateRelationships < ActiveRecord::Migration
def change
create_table :relationships do…
John
- 11
- 1