Subject: | Columns in constraints duplicated in Schema defs |
Consider the following Oracle table definition:
Create table ep_status (
status_id Number NOT NULL ,
status_name Varchar2 (20) NOT NULL ,
Constraint pk_ep_status primary key (status_id)
USING INDEX TABLESPACE etl_idx
)
TABLESPACE etl_data
/
Alter table ep_status add Constraint ep_status_u1 unique (status_name)
USING INDEX TABLESPACE etl_idx
/
The unique constraint generated bu DBIx::Class::Schema::Loader is:
__PACKAGE__->add_unique_constraint(
"ep_status_u1",
["status_name", "status_name", "status_name", "status_name"],
);
Any single-column unique constraint in my schema has the column name
repeated four times. However, When the quniue constraint is based on a
concatenated key, DBIC::Schema::Loader constraint is correct:
Alter table ep_section add Constraint ep_section_u1 unique
(section_name,source_id)
USING INDEX TABLESPACE etl_idx
/
gives
__PACKAGE__->add_unique_constraint("ep_section_u1", ["section_name",
"source_id"]);
I don't know if this is Oracle specific or not