Displaying 1 result from an estimated 1 matches for "fk_sect_id".
2006 May 18
8
Concatenated key
...39;m using SQL Server
2005.
My tables look roughly like this:
CREATE TABLE USERS (
USR_ID VARCHAR(25) NOT NULL PRIMARY KEY,
USR_PASS VARCHAR(25)
)
CREATE TABLE SECTOR (
SECT_ID TINYINT NOT NULL PRIMARY KEY,
SECT_NAME VARCHAR(25)
)
CREATE TABLE PERMISSION (
FK_USR_ID VARCHAR(25) NOT NULL,
FK_SECT_ID TINYINT NOT NULL
)
ALTER TABLE PERMISSION
ADD CONSTRAINT PK_PERMISSION
PRIMARY KEY (FK_USR_ID,FK_SECT_ID)
And my models look like this:
class User < ActiveRecord::Base
set_primary_key "USR_ID"
def self.table_name() "USERS" end
has_many :permission
end
class Sector <...