similar to: schema.rb: foreign keys and reference data

Displaying 20 results from an estimated 100000 matches similar to: "schema.rb: foreign keys and reference data"

2006 Apr 06
4
using two foreign keys to the same table
i am working on a task manager with ruby on rails. it is my first major project, so i''m still gettng my feet wet as i learn. i''ve been trying to use the built in relationships to link my tables together, but i''m not able to use the same naming conventions. for each task, it has a field for the creator, and another field for the assignee. both of these fields
2006 Jul 10
1
Migration and foreign keys
Hi, I''m using the ''rake db_schema_dump'' command to clone the structure of the developement database into the test database. Unfortunatelly, the schema.rb file doesn''t contain any information about the foreign keys of the tables. For this reason all the test that concern about the relations are not working has suposed. Is this a limitation of Rails or am I
2006 Jul 22
1
Newbie: Consistency and foreign keys
Hi, Are there any good examples somewhere on how to create a schema with several tables and foreign keys? My scaffold lets me edit my database IDs rather than the actual content, and I can add IDs that generate errors later, so perhaps I''m doing something wrong... -Ketil
2006 May 25
0
Has_many, dependent=false, foreign keys legacy issues...
I''m playing around with some legacy schemas; ones that make extensive use of foreign key update/delete rules. I''ve been working through a variety of cases to understand how different configurations within Rails will play with the DB. If the delete rule is Cascade and :dependent=>false, deleting the parent deletes the children, exactly as the DB rules specify and do so
2006 Jun 21
1
Migration with foreign key won''t work
Hi all I use the plugin which supports foreign keys with migrations: http://wiki.rubyonrails.org/rails/pages/Foreign+Key+Schema+Dumper+Plugin/versions/12 I have created the following migration file: class AddArtistsTable < ActiveRecord::Migration def self.up create_table :artists, :force => true do |t| t.column :name, :string, :limit => 100 t.column :artist_type_id,
2006 Jun 20
0
habtm has_many through and foreign keys
I have two models Role and Task ..and a join table/model RoleTask Now both roles and tasks have id as a primary key and name which is a unique identifier I want the join table to hold role_id and task_name I''ve tried using habtm with foreign key and association foreign keys set up and I''ve tried using has_many :through ..but they all seem to someone want to work with the
2006 Apr 04
2
Foreign keys not showing!
I''m new at this so please be patient. I have a very simple schema consisting of a around 10 tables in Postgresql. The aim is to provide a system for PC administrators to keep track of PC''s dotted around various venues (shops, libraries etc.). The sort of info I want to store is PC specs, PC network specs, PC ownership specs, PC location specs and contact person details. So I end
2006 Jan 18
3
Support for foreign keys in Migrations
Is there any work being done to add support for defining foreign keys in ActiveRecord Migrations? If not is it something that people would find useful or do most people here believe in the "Application Database" style over the "Integration Database" style [1] as defined by Fowler? I''d love to see support for foreign keys in Migrations. For selfish reasons
2006 May 17
2
Association data clobbering (foreign keys too?)
Can someone please confirm or correct the following statements? If I have the following tables create table as (id int, [...], b_id int); create table bs (id int, [...], a_id int); create table as_bs (a_id int, b_id int); and the associations woould be defined like this class A << ... habtm :bs belongs_to :b end so my Model A has a habtm collection of Bs *plus* a direct
2007 Aug 30
1
belongs_to with foreign keys that reference non primary key columns
Hello, I have a situation where the foreign key into a table doesn''t correspond to that table''s primary key: my_table ------------- id (pk) name ... other_table -------------- id (pk) my_table_name (fk references my_table(name)) ... I want to be able to say something like: class OtherTable < ActiveRecord::Base belongs_to :my_table, :foreign_key => { :my_table_name
2006 Feb 07
1
displaying foreign keys help request
Hi .. (I seem to be having some problems getting my posts to the list for some reason. Sorry if you see this as a repost). A conceptual question this time. I have the relation: member (m)---(1) member_type The schema looks something like this (simplified + PGSQL) create table member_types ( id serial, info varchar( 20 ) not null, primary key( id
2005 Dec 20
0
db/schema.rb and PostgreSQL sequences
Hello. I''m working the "proper way" with creating the initial db schema via migrations and db/schema.rb. However, I have a bit of a special need, and need to know if anyone knows the solution to this; I need a sequence that is common to several tables - a "data id" that gives a sort of unique object number to every row in every table. Some associated tables (a
2008 Apr 03
0
Importing (bootstrapping) the initial data from fixtures(.yml) with foreign keys in Rails 2.0
Hi, I''m trying to import data from YAML files in Rails 2.0.2. I learned that new features came out for fixtures at RailsCasts http://railscasts.com/episodes/81 . And, in Rails 1.2.6 and before, I used a "rake" task I found online. Looks like there are many variations for this "bootstrap" file. Do you know if there''s a file available that does something
2006 Aug 09
0
Schema Design: ActiveRecord and Group-Oriented Data
I will soon begin developing a group-oriented web application in Rails (think along the lines of BaseCamp, or Yahoo! Groups). So there will be plenty of data that will logically separate along group lines; as a concrete simple example, let''s suppose one feature is a message board to be modelled by Messages. When a user logs in to the app, she will be able to choose a group she
2006 May 29
2
foreign keys and referential integrity
Sans rails my normal approach to handling this would be to enforce it in the database and when a database operation failed I''d try to validate the model to produce an error message. It''s always served me pretty well. Rails expects you to validate before commiting but of course this does nothing to guarantee referential integrity. It''s perfectly possible for one
2006 Feb 19
1
One Model from two Tables with no foreign keys
I would like to create a model that is based on two database tables: Table1 --------- id (PK) data1 Table2 ---------- id (PK) data2 There is a one-to-one relationship between the records of Table1 and Table2. (That is, for every record in Table1 there is a record with matching id in Table2 and vice versa). The problem is that I cannot alter the table schemas in any way, so I cannot add
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/.
2006 Jan 20
0
How to install the Foreign Key Schema Dumper Plugin
I don''t know how to install it. Does it support to generate foreign_key_constraint when I execute db_schema_dump? thanks.
2006 Jan 28
0
having problems to map a existing schema in model classes
Hi, I?m doing a project for a company (my first big project in rails). The company alredy has a database schema, with lots of data, so I don?t want to change the database schema, but I don?t know how to map some associations. Example: Table: application Primary Key: idapplication Table: module Primary Key: idmodule Foreign Key: idapplication References aplicattion: idapplication Table:
2006 Jan 28
0
having problems to map a existing schema into model classes
Hi, I?m doing a project for a company (my first big project in rails). The company alredy has a database schema, with lots of data, so I don?t want to change the database schema, but I don?t know how to map some associations. Example: Table: application Primary Key: idapplication Table: module Primary Key: idmodule Foreign Key: idapplication References aplicattion: idapplication Table: