search for: add_foreign_key_constraint

Displaying 4 results from an estimated 4 matches for "add_foreign_key_constraint".

2006 Jun 21
1
Migration with foreign key won''t work
...tring, :limit => 100 t.column :artist_type_id, :integer t.column :about, :text end create_table :artist_types, :force => true do |t| t.column :artist_type, :string, :limit => 20 t.column :description, :string, :limit => 20 end # Foreign Keys add_foreign_key_constraint :artists, :artist_type_id, :artist_types, :artist_type, :on_update => :cascade, :on_delete => :restrict # artists(artist_type_id) references artist_types(artist_type) end def self.down drop_table :artists drop_table :artist_types # Foreign Keys remove_foreign_key_cons...
2005 Dec 05
0
bug in bubbleshare's Active Record extensions?
I''m using add_foreign_key_constraint and remove_foreign_key_constraint from Bubbleshare''s Active Records Extension plugin now to manage the foreign key relationships I describe in my other recent posting. The constraints get added within migrations, but I''m running into two problems (Rails 0.14.3, PostgreSQL db):...
2006 Apr 27
3
Removing a default value for a foreign key with not null set
Hi all, For various reasons I need to have foreign keys with not null constraints. Eg: create_table :people do |t| t.column :name, :string t.column :household_id, :integer, :null => false end create_table :households do |t| t.column :name, :string end add_foreign_key_constraint :people, :household_id, :households, :id So the people table has a foreign key into households (household_id), and not null is enabled on the column. My problem is that I get default values of 0 for household_id when instantiating new Person object. Person.new.household_id # == 0 validates...
2006 Jul 13
6
Migrations + foreign keys
Hi all, In the AWDR author use the execute method to declare foreign keys: execute "alter table.... add constraint.... foreign key...." Is there a ruby sintax to declare a foreign key in a migration class? -- Posted via http://www.ruby-forum.com/.