Displaying 1 result from an estimated 1 matches for "area_code_id".
2008 Jul 01
6
validates_associated & foreign keys
...a_codes (
id INT UNSIGNED auto_increment primary key
...
);
CREATE TABLE markets (
id INT UNSIGNED auto_increment primary key,
...
);
CREATE TABLE area_codes_markets (
id INT UNSIGNED auto_increment primary key,
market_id INT UNSIGNED NOT NULL,
area_code_id INT UNSIGNED NOT NULL,
INDEX(market_id),
INDEX(area_code_id),
CONSTRAINT UNIQUE (market_id, area_code_id),
CONSTRAINT FOREIGN KEY(market_id)
REFERENCES markets(id) MATCH FULL ON DELETE RESTRICT,
CONSTRAINT FOREIGN KEY(area_code_id)
REFERENCES area_codes(id) MATC...