search for: on_delete

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

Did you mean: dn_delete
2006 Jun 21
1
Migration with foreign key won''t work
...e_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_constraint :artists, :foreign_key => :artist_type_id end end When running it, everything goe...
2006 Apr 07
4
belongs_to and lookup tables
I have two classes, Listing and Warranty. A Listing (think of it as a product) may or may not have a Warranty from a lookup table. When I want the Warranty.company for a given Listing I want to say the following: @listing = Listing.find(4) @company = @listing.warranty.company In order to do that I did the following: class Listing < ActiveRecord::Base belongs_to :warranty end and
2005 Dec 05
0
bug in bubbleshare's Active Record extensions?
...didn''t include the constraints, so maybe this chunk of things is just plain busted. 2. Consider this migration: class AddConstraints < ActiveRecord::Migration def self.up add_foreign_key_constraint "tracks", "album_id", "albums", "id", :on_delete => :restrict add_foreign_key_constraint "tracks", "artist_id", "artists", "id", :on_delete => :restrict add_foreign_key_constraint "albums", "artist_id", "artists", "id", :on_delete => :restrict end...
2013 Mar 11
0
Any interest in various features from "schema_plus" gem?
...9;deleted_at IS NULL'' } # support for Postgresql conditions, expression, index methods, case-insensitive Foreign-key constraints: t.integer :post_id, foreign_key: true # creates a foreign key constraint to table posts t.belongs_to :post, foreign_key: { on_delete: :cascade } # has various options connection.foreign_keys(table) #=> array of ForeignKeyDefinition objects # and add_foreign_key, remove_foreign_key, connection.reverse_foreign_keys # schema_plus actually has ''foreign_key: true'' as the default behavior, for...