You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by Karl Stenerud <ka...@webartjapan.com> on 2003/04/03 04:48:14 UTC
Torque ignoring unique constraint?
Torque seems to be ignoring the <unique> elements in my schema.
I built the following table in the schema:
<table name="adminUser" description="Administrators">
<column
name="id"
required="true"
primaryKey="true"
type="INTEGER"
description="Administrator Id"/>
<column
name="username"
required="true"
type="VARCHAR"
size="16"
description="Username"/>
<column
name="password"
required="true"
type="VARCHAR"
size="8"
description="Password"/>
<unique>
<unique-column name="id"/>
<unique-column name="username"/>
</unique>
</table>
But when I check mysql to see what it produced, I get the following:
# mysqldump --no-data tokoname;
-- MySQL dump 8.22
--
-- Host: localhost Database: testdbase
---------------------------------------------------------
-- Server version 3.23.52-log
--
-- Table structure for table 'ID_TABLE'
--
CREATE TABLE ID_TABLE (
ID_TABLE_ID int(11) NOT NULL default '0',
TABLE_NAME varchar(255) NOT NULL default '',
NEXT_ID int(11) default NULL,
QUANTITY int(11) default NULL,
PRIMARY KEY (ID_TABLE_ID),
UNIQUE KEY TABLE_NAME (TABLE_NAME)
) TYPE=MyISAM;
--
-- Table structure for table 'adminUser'
--
CREATE TABLE adminUser (
id int(11) NOT NULL default '0',
username varchar(16) NOT NULL default '',
password varchar(8) NOT NULL default '',
PRIMARY KEY (id)
) TYPE=MyISAM;
I'm also able to add multiple users with the same username in my application.