search for: add_index

Displaying 20 results from an estimated 73 matches for "add_index".

2007 Nov 14
6
a few add_index questions..
...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 on every foreign key in all of the tables? in my tasks table, i''m going to have a foreign key for the user and the project. seems like i could add up to 3 indexes.. add_index :tasks, [:project_id] add_index :tasks, [:user_id] add_index :tasks, [:project_id, :user_id], :unique => true...
2006 Sep 05
0
rake craziness with Migrate as a dependency
...create_table("rails_crons") -> 0.1010s -- add_column(:rails_crons, :concurrent, :boolean) -> 0.2100s ** Execute db:migrate == Init: migrating ============================================================ -- create_table("colors", {:force=>true}) -> 0.0800s -- add_index("colors", ["product_id", "name"], {:name=>"product_name", :unique=>true}) -> 0.2300s -- create_table("groups", {:force=>true}) -> 0.0700s -- add_index("groups", ["parent_id"], {:name=>"groups_parent_i...
2006 Apr 02
2
rails db indexing and through association
...table.column :name, :string, :limit => 100 table.column :content_type, :string, :limit => 100 table.column :data, :blob table.column :picturable_id, :int, :null => false table.column :picturable_type, :string, :limit => 10, :null => false end add_index :pictures, [:picturable_type], :name => "pictures_index_picturable_type" add_index :pictures, [:picturable_id], :name => "pictures_index_picturable_id" -- Surendra Singhi http://ssinghi.kreeti.com, http://www.kreeti.com Read my blog at: http://cuttingtheredtape.blogs...
2006 Jun 05
0
Failed to install Globalize plugin
...39;' 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 -- add_index(:globalize_countries, :code) -> 0.3000s -- create_table(:globalize_translations, {:force=>true}) -> 0.1600s -- add_index(:globalize_translations, [:tr_key, :language_id]) -> 0.2310s -- add_index(:globalize_translations, [:table_name, :item_id, :language_id]) -> 0.2200s -...
2007 Jun 07
0
Unique :key not maintained after add_indexes?
Hi, When adding an index to another one using add_indexes I get duplicates even though I use the :key attribute. For example: def test_add_indexes_uniqueness index1 = Ferret::Index::Index.new(:key => :id) index2 = Ferret::Index::Index.new(:key => :id) # Add two items with same id index1 << {:id => 23, :da...
2006 Mar 19
3
Can''t add data during migration if column is called "type"
...9;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 end add_index :deposit_types, :type_code, :unique add_index :deposit_types, :description, :unique [ ["pc_of_tcp", "percentage of total cash price"], ["amount", "amount"], ["payments", "payments"] ].each do |type, description|...
2006 Apr 17
7
MySQL backticks and column names
...UE INDEX key ON config (key) .../lib/active_record/connection_adapters/abstract_adapter.rb:120:in `log'' .../lib/active_record/connection_adapters/mysql_adapter.rb:185:in `execute'' .../lib/active_record/connection_adapters/abstract/schema_statements.r b:196:in `add_index'' Which led me to the conclusion that the problem was in the add_index method of the SchemaStatements module. I added this method to the MySQL connection adapter and changed: execute "CREATE #{index_type} INDEX #{index_name} ON #{table_name} (#{Array(column_name).join(&quot...
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 look...
2006 Jul 21
0
[Slightly OT] Need Query Help
...t;, :integer, :limit => 10, :default => 0, :null => false t.column "name", :string, :limit => 100, :default => "", :null => false t.column "charge_id_number", :string, :limit => 15, :default => "", :null => false end add_index "charges", ["charge_type_id"], :name => "charges_FKIndex2" create_table "clients", :force => true do |t| t.column "person_id", :string, :limit => 7 t.column "f_name", :string, :limit => 20 t.column "l_name&q...
2006 Dec 20
1
Problem with Oracle function-based indexes in Rails
Hello, We''re using Rails on an Oracle database. If we define an index like the following, we end up with problems during the "db:schema:dump" rake target. add_index "emcolumn", ["upper(name)"], :name => "ind_emcolumn_uname" The created schema.rb file contains: add_index "emcolumn", ["sys_nc00013$"], :name => "ind_emcolumn_uname" Well, we are aware we can use "config.active_record.schem...
2006 Nov 20
5
Parallal Building?
I''m trying to index ~130,000 documents [soon to grow to about 500,000 documents] and I''m wondering if its possible to combine ferret databases or in some other way split up the building process. Normally, indexing 130k documents wouldn''t be that painful except that there are different types of links between these documents and they are not absolute (so for example
2009 Nov 04
0
The error occurred while evaluating nil.prefetch_primary_key
...# Name t.string :descr # Description t.integer :sort_number # for sorting - for a project in 10-steps t.references :project # Link to an ''Project'' t.timestamps end add_index :way_search_runs, :project_id end def self.down drop_table :way_search_runs end end class CreateConnectionCosts < ActiveRecord::Migration def self.up create_table :connection_costs do |t| t.decimal :cost ,:precision=>10,:scale=>4 ,:default=>100.0 # ab...
2009 Feb 02
2
looking for help with NoMethodError: undefined method `key?' for #<String:0x4795488>
...:default => "", :null => false t.column "short_description", :string, :limit => 255, :default => "", :null => false t.column "description", :text, :default => "", :null => false end add_index "entities", ["taxa_order"], :name => "taxa_order" add_index "entities", ["taxa_family"], :name => "taxa_family" add_index "entities", ["taxa_genus"], :name => "taxa_genus" add_index "...
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 ---------------------------
2007 Dec 21
0
db:migrate problem
...t.string :login t.string :email t.string :crypted_password, :limit => 40 t.string :salt, :limit => 40 t.timestamps t.string :remember_token t.datetime :remember_token_expires_at t.string :openid_url end add_index :people, :login add_index :people, :email add_index :people, :openid_url end ... end 004_drop_login_name: class DropLoginName < ActiveRecord::Migration def self.up remove_index :people, :login remove_column :people, :login end def self.down raise ActiveRecord::Irr...
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 "DROP INDEX #{quote_column_name(index_name(table_name, options))} ON #{quote_table_name(table_name)}" would help (and would be logical). Best regards Savar -- You received this message because you are sub...
2006 Jul 05
5
Help with migrations and create
After creating a table in a create table migration, I''m then attempting to populate a couple of rows of data in the table using the create method. The first row gets inserted into the database, but any further calls generate a select against the database, but no insert. Am I doing something wrong, or is it inappropriate to create more than a single row of data in a table using
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 index_sf_events_on_account_id ON sf_events (account_id); But instead I get something...
2011 Jun 11
1
Having a problem adding a foreign key
...uot;last_sign_in_ip" t.datetime "created_at" t.datetime "updated_at" t.string "firstname" t.string "lastname" t.text "school" t.text "major" t.string "sex" t.integer "zipcode" end add_index "users", ["email"], :name => "index_users_on_email", :unique => true add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true end -- You received this message becaus...
2006 Apr 17
20
Rubricks - CMS on Rails
Hi list, I made an open source CMS powered by Rails, named Rubricks. I have a web page for Rubricks. You can download it or view a flash demo there. Please try them and feed me back, like bug report etc. Check it out at: http://rubricks.org/index_en.html Thanks. Shouta