Displaying 20 results from an estimated 600 matches similar to: "Problem with Oracle function-based indexes in Rails"
2008 Nov 28
1
True ActiveRecord result set iteration
Hello,
For an internal project we were looking for a solution which extends
ActiveRecord by an iterator function. Using find(:all) is no fun if you
have to process some 10.000 records.
Until now there have been two ways of dealing with that scenario:
- write your logic a second times (e.g. use stored procedure)
- bet on AR plugins which work around that limitation by fetching IDs and
2007 Nov 14
6
a few add_index questions..
on previous apps i hadn''t really worried much about adding foreign key
indexes on my tables just because they''ve been fairly small and i
didn''t really think i needed them.
well, i''m working on something now that has the potential to have a
lot more data, and a lot more foreign keys.
so i have 3 tables... users, projects, and tasks.. should i be using
add_index
2006 Apr 02
2
rails db indexing and through association
Hello,
Say, I have a pictures table, and there are many objects which can have
pictures, so I define a picturable type. Now, to make the query for pictures
more efficient I should index the picture table using both picturable_type and
picturable_id.
Is this the correct approach to indexing the table, or can things be done
better? I want the database retrieval operation to be extremely fast (I
2006 Mar 19
3
Can''t add data during migration if column is called "type"
Hi
I''m new to Rails. This is my first application and I''m trying to set
up a schema I''ve hand-crafted as a migration.
Does anybody know why this...
# deposit_types
create_table :deposit_types do |table|
table.column :type_code, :string, :limit => 20, :null => false
table.column :description, :string, :limit => 50, :null => false
2006 Mar 20
1
Migrations with multi-column indexes
Hey Folks,
I can''t really glean this from the documentation.
Is there a way to do: add_index(table_name, column_name, index_type)
within my migration for an index that spans multiple columns? Ie: A
covering index on FIRST_NAME, LAST_NAME or something like that?
Best,
Brian
---------------------------
Brian Corrigan
---------------------------
2006 Feb 07
5
OCI adapter slowdown on dictionary access
Hi,
after some experience with Rails on MySQL databases I gave it a try on one
of our larger Oracle database.
I was facing a problem when Rails tried to detect the columns for a
model/table. The appropriate statement ran about 1 min which led to a
timeout.
Our Oracle guru told me to analyze the SYSTEM schema. After that hadn''t
helped, he said the only remaining chance is to use a
2006 Oct 24
1
test env. differs from development env, tests breaking
I just got a new PC at work. My project files were copied from my old
drive. Just to be sure, though, I have erased them and pulled them back
down from source control.
My development database server is MySQL
My test database server is sqlite3
I am having a confusing issue: tests are failing and errors are
happening that weren''t happening before. Furthermore, they aren''t
2006 Apr 17
7
MySQL backticks and column names
The upgrade to Rails 1.1 hurt my ability to run tests because it
generated the following MySQL error:
Mysql::Error: You have an error in your SQL syntax; check the manual
that corresponds to your MySQL server version for the right syntax to
use near ''key ON config (key)'' at line 1: CREATE UNIQUE INDEX key ON
config (key)
I have a table called `config` with a column
2006 Jul 30
1
Doubt on composite index
The AWDwR book has the following:
add_index :categories_products, [:product_id, :category_id]
add_index :categories_products, :category_id
The first, composite index actually serves two purposes: it creates an index which can be searched
on both foreign key columns, and with most databases it also creates an
index that enables fast lookup by the product id. The second index then
completes
2010 Mar 30
2
remove_index missed quote_table_name
in lib/active_record/connection_adapters/abstract/schema_statements.rb
there is a missing quote_table_name in line 286 (def remove_index):
execute "DROP INDEX #{quote_column_name(index_name(table_name,
options))} ON #{table_name}"
so my "keys" table can get an index with "add_index" but can''t remove
it (without tweaking)
replacing it to
execute
2013 Jul 23
1
Postgres adapter misconfigured on Linux?
I''ve written a simple Rails migration that adds an index to an existing
Postgres table:
class AddIndexToEvents < ActiveRecord::Migration
> def change
> add_index :sf_events, :account_id
> end
> end
However, when I run the migration, it fails due to a syntax error on the
CREATE INDEX line. I''m expecting some SQL like this to be generated:
CREATE INDEX
2011 Jun 11
1
Having a problem adding a foreign key
I keep getting this exception "SQLite3::SQLException: no such
column: books.user_id: SELECT "books".* FROM "books" WHERE
("books".user_id = 4)" ,which sounds like there is no user_id in books
table.So i just installed foreigner plugin and added "
t.integer :user_id, :null => false" and
"add_foreign_key(:books, :users)" in book
2006 Sep 05
0
rake craziness with Migrate as a dependency
Hi everyone,
For one of our projects we have a need to deploy and maintain a demo.
As a result I''ve attempted to setup a set of rake tasks for the job.
My goal is have one rake task called "deploy_demo" which purges the
database, migrates to the current schema, and loads the db from a set
of fixture files in a specified location.
I''ve written two new tasks the perform
2006 Nov 28
3
remove_index appends suffix "_index" to the given name!
Hi all
This creates an index with the name position_and_produkt_id_uniq:
add_index :bilder, [:produkt_id, :position], :unique => true, :name =>
:position_and_produkt_id_uniq
This should remove the same one:
remove_index :bilder, :position_and_produkt_id_uniq
Sadly I get the following error:
Mysql::Error: Can''t DROP ''bilder_position_and_produkt_id_uniq_index'';
2010 Aug 23
1
Cannot migrate database, strange error!
Im using restful authentication, and i changed the username model from
login to username. The error is Mysql::Error: Key column ''login'' doesn''t
exist in table: CREATE UNIQUE INDEX `index_users_on_login` Heres the
trace:
DEPRECATION WARNING: Rake tasks in
vendor/plugins/restful-authentication/tasks are deprecated. Use
lib/tasks instead. (called from
2006 Jun 05
0
Failed to install Globalize plugin
My envrionment is Rails 1.1.2, Ruby 1.8.4, MySQL 5.0.21 on WinXP. When I
run ''rake migrate'' after pulling the lastest 1.1 branch of Globalize
plugin, I get the following error message:
(in C:/Rails/Application/medicalmind)
== GlobalizeMigration: migrating
==============================================
-- create_table(:globalize_countries, {:force=>true})
-> 0.2110s
2006 Mar 15
3
Self-referential join model does not work
I have been trying to model a labeled graph using ActiveRecord (trunk
version). Basically, I have a ''Node'' model which represents a node linking
to other nodes. Links (aka edges) are labeled (i.e., have a ''label''
attribute and other behavior). Thus I decided to model edges as an ''Edge''
model and use a ''has_many :trough''
2009 Feb 22
2
Mysql error unknown column 'columns.user_id'
Had this error when trying to add comments to another user''s photo.
ActiveRecord::StatementInvalid in User photosController#show
Mysql::Error: Unknown column ''comments.user_id'' in ''on clause'': SELECT
photos.`id` AS t0_r0, photos.`user_id` AS t0_r1, photos.`title` AS
t0_r2, photos.`body` AS t0_r3, photos.`created_at` AS t0....
I did create a user_id
2006 Mar 29
2
1.1 ruby schema breaks MySQL FULLTEXT index
If you used MySQL FULLTEXT indexes and just upgraded to Rails 1.1, watch
out for this one. Rails 1.1 now defaults to Ruby as your schema format.
So instead of development-structure.sql, Rake will use schema.rb.
That''s portable and good stuff overall but there is a slight
compatibility issue. Ruby schema doesn''t know how to do FULLTEXT index
syntax for MySQL.
To work around it,
2006 Jul 21
0
[Slightly OT] Need Query Help
I need to select 1 record from each client. This record has the charge
with the most severe charge type (lowest charge_type_id). How do I go
about this?
I have been using a find_by_sql query out of the client.rb that looks
like:
SELECT c.f_name AS f_name, c.l_name AS l_name, c.gender AS gender,
c.race AS race, c.dob AS dob, c.address AS address, c.city AS
city,
c.state AS