similar to: Can''t add data during migration if column is called "type"

Displaying 20 results from an estimated 1100 matches similar to: "Can''t add data during migration if column is called "type""

2006 Mar 29
3
Loading records during class definition
I''ve created a look-up table in my database that currently has 4 rows. I want to access these as constants in the application because that''s effectively what they are. I tried this... class StockRuleLevel < ActiveRecord::Base has_many :stock_rules SITE = find(:first, :conditions => "type_code = ''site''").id MAKE
2006 Apr 22
6
STI and type tables?
So by default to get STI, I would have something like: create_table :items do |t| t.column "type", :string t.column "title", :string end But if I want to store those type values in a separate table, such that I have ... create_table :items do |t| t.column "item_type_id", :string t.column "title", :string
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 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
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 =>
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 ---------------------------
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 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 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
2009 Nov 04
0
The error occurred while evaluating nil.prefetch_primary_key
The error occurred while evaluating nil.prefetch_primary_key? Hi, I have a problem with a model when I have 3 belongs_to relations in one the middle. This example is a subset of a grid-routing project: n 1 1 n +------------ Project Connection ------- ConnectionCost +------------ WaySearchRun