When I try to map with subsonic 3.0.0.3 database, i get error:
"Running transformation: System.InvalidOperationException: Sequence contains more than one matching element..."
Where i should look for error?
When I try to map with subsonic 3.0.0.3 database, i get error:
"Running transformation: System.InvalidOperationException: Sequence contains more than one matching element..."
Where i should look for error?
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';
CREATE SCHEMA IF NOT EXISTS osm2
DEFAULT CHARACTER SET cp1251 COLLATE cp1251_general_ci;
USE osm2
;
-- Table mydb
.sw_profile
CREATE TABLE IF NOT EXISTS osm2
.sw_profile
(
id
INT NOT NULL ,
name
VARCHAR(45) NOT NULL ,
configuration
VARCHAR(500) NOT NULL ,
comments
VARCHAR(45) NULL ,
PRIMARY KEY (id
) )
ENGINE = InnoDB;
-- Table mydb
.sw_type
CREATE TABLE IF NOT EXISTS osm2
.sw_type
(
id
INT NOT NULL,
name
VARCHAR (45) NOT NULL,
ports_num
INT NOT NULL,
trunc_ports
VARCHAR (45) NOT NULL,
supports_dhcp
TINYINT (1) NOT NULL,
PRIMARY KEY (id
)
)
ENGINE = INNODB;
-- Table mydb
.sw
CREATE TABLE IF NOT EXISTS osm2
.sw
(
id
INT NOT NULL,
sn
VARCHAR (45) NULL,
mac
VARCHAR (45) NOT NULL,
ip
VARCHAR (45) NOT NULL,
comments
VARCHAR (45) NULL,
sw_profile_id
INT NOT NULL,
sw_type_id
INT NOT NULL,
PRIMARY KEY (id
),
INDEX fk_sw_sw_profile
(sw_profile_id
ASC),
INDEX fk_sw_sw_type1
(sw_type_id
ASC),
CONSTRAINT fk_sw_sw_profile
FOREIGN KEY (sw_profile_id
)
REFERENCES mydb
.sw_profile
(id
)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT fk_sw_sw_type1
FOREIGN KEY (sw_type_id
)
REFERENCES mydb
.sw_type
(id
)
ON DELETE NO ACTION
ON UPDATE NO ACTION
)
ENGINE = INNODB
DEFAULT CHARACTER SET = cp1251;
-- Table mydb
.port
CREATE TABLE IF NOT EXISTS osm2
.port
(
id
INT NOT NULL,
name
VARCHAR (45) NOT NULL,
state
TINYINT (1) NOT NULL,
user_id
INT NULL,
sw_id
INT NOT NULL,
PRIMARY KEY (id
),
INDEX fk_port_sw1
(sw_id
ASC),
CONSTRAINT fk_port_sw1
FOREIGN KEY (sw_id
)
REFERENCES mydb
.sw
(id
)
ON DELETE NO ACTION
ON UPDATE NO ACTION
)
ENGINE = INNODB;
-- Table mydb
.vlan
CREATE TABLE IF NOT EXISTS osm2
.vlan
(
id
INT NOT NULL,
name
VARCHAR (45) NOT NULL,
tag
VARCHAR (45) NOT NULL,
comments
VARCHAR (500) NULL,
PRIMARY KEY (id
)
)
ENGINE = INNODB;
-- Table mydb
.address
CREATE TABLE IF NOT EXISTS osm2
.address
(
id
INT NOT NULL,
name
VARCHAR (45) NOT NULL,
short_name
VARCHAR (45) NOT NULL,
comments
VARCHAR (45) NULL,
sw_id
INT NOT NULL,
PRIMARY KEY (id
),
INDEX fk_address_sw1
(sw_id
ASC),
CONSTRAINT fk_address_sw1
FOREIGN KEY (sw_id
)
REFERENCES mydb
.sw
(id
)
ON DELETE NO ACTION
ON UPDATE NO ACTION
)
ENGINE = INNODB;
-- Table mydb
.tariff
CREATE TABLE IF NOT EXISTS osm2
.tariff
(
id
INT NOT NULL,
name
VARCHAR (45) NOT NULL,
price
DOUBLE NOT NULL,
speed
VARCHAR (45) NOT NULL,
PRIMARY KEY (id
)
)
ENGINE = INNODB;
-- Table mydb
.client
CREATE TABLE IF NOT EXISTS osm2
.client
(
id
INT NOT NULL,
utm_id
VARCHAR (45) NULL,
utm_login
VARCHAR (45) NULL,
ip
VARCHAR (45) NOT NULL,
ip_second
VARCHAR (45) NULL,
contacts
VARCHAR (500) NULL,
comments
VARCHAR (500) NULL,
act
VARCHAR (500) NULL,
vlan_id
INT NOT NULL,
address_id
INT NOT NULL,
tariff_id
INT NOT NULL,
PRIMARY KEY (id
),
INDEX fk_client_vlan1
(vlan_id
ASC),
INDEX fk_client_address1
(address_id
ASC),
INDEX fk_client_tariff1
(tariff_id
ASC),
CONSTRAINT fk_client_vlan1
FOREIGN KEY (vlan_id
)
REFERENCES mydb
.vlan
(id
)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT fk_client_address1
FOREIGN KEY (address_id
)
REFERENCES mydb
.address
(id
)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT fk_client_tariff1
FOREIGN KEY (tariff_id
)
REFERENCES mydb
.tariff
(id
)
ON DELETE NO ACTION
ON UPDATE NO ACTION
)
ENGINE = INNODB;
-- Table mydb
.port_has_vlan
CREATE TABLE IF NOT EXISTS osm2
.port_has_vlan
(
port_id
INT NOT NULL,
vlan_id
INT NOT NULL,
PRIMARY KEY (port_id
, vlan_id
),
INDEX fk_port_has_vlan_port1
(port_id
ASC),
INDEX fk_port_has_vlan_vlan1
(vlan_id
ASC),
CONSTRAINT fk_port_has_vlan_port1
FOREIGN KEY (port_id
)
REFERENCES mydb
.port
(id
)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT fk_port_has_vlan_vlan1
FOREIGN KEY (vlan_id
)
REFERENCES mydb
.vlan
(id
)
ON DELETE NO ACTION
ON UPDATE NO ACTION
)
ENGINE = INNODB;
-- Table mydb
.request_state
CREATE TABLE IF NOT EXISTS osm2
.request_state
(
id
INT NOT NULL,
name
VARCHAR (45) NOT NULL,
PRIMARY KEY (id
)
)
ENGINE = INNODB;
-- Table mydb
.request_type
CREATE TABLE IF NOT EXISTS osm2
.request_type
(
id
INT NOT NULL,
name
VARCHAR (45) NOT NULL,
comments
VARCHAR (500) NULL,
PRIMARY KEY (id
)
)
ENGINE = INNODB;
-- Table mydb
.request
CREATE TABLE IF NOT EXISTS osm2
.request
(
id
INT NOT NULL,
date
DATETIME NOT NULL,
comments
VARCHAR (500) NULL,
log
VARCHAR (500) NULL,
request_state_id
INT NOT NULL,
request_type_id
INT NOT NULL,
client_id
INT NOT NULL,
PRIMARY KEY (id
),
INDEX fk_request_request_state1
(request_state_id
ASC),
INDEX fk_request_request_type1
(request_type_id
ASC),
INDEX fk_request_client1
(client_id
ASC),
CONSTRAINT fk_request_request_state1
FOREIGN KEY (request_state_id
)
REFERENCES mydb
.request_state
(id
)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT fk_request_request_type1
FOREIGN KEY (request_type_id
)
REFERENCES mydb
.request_type
(id
)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT fk_request_client1
FOREIGN KEY (client_id
)
REFERENCES mydb
.client
(id
)
ON DELETE NO ACTION
ON UPDATE NO ACTION
)
ENGINE = INNODB;
-- Table mydb
.department
CREATE TABLE IF NOT EXISTS osm2
.department
(
id
INT NOT NULL,
name
VARCHAR (45) NOT NULL,
comments
VARCHAR (45) NOT NULL,
PRIMARY KEY (id
)
)
ENGINE = INNODB;
-- Table mydb
.group
CREATE TABLE IF NOT EXISTS osm2
.group
(
id
INT NOT NULL,
name
VARCHAR (45) NOT NULL,
PRIMARY KEY (id
)
)
ENGINE = INNODB;
-- Table mydb
.account
CREATE TABLE IF NOT EXISTS osm2
.account
(
id
INT NOT NULL,
login
VARCHAR (45) NOT NULL,
password
VARCHAR (45) NOT NULL,
group_id
INT NOT NULL,
PRIMARY KEY (id
),
INDEX fk_account_group1
(group_id
ASC),
CONSTRAINT fk_account_group1
FOREIGN KEY (group_id
)
REFERENCES mydb
.group
(id
)
ON DELETE NO ACTION
ON UPDATE NO ACTION
)
ENGINE = INNODB;
-- Table mydb
.staff
CREATE TABLE IF NOT EXISTS osm2
.staff
(
id
INT NOT NULL,
name
VARCHAR (45) NOT NULL,
contacts
VARCHAR (45) NOT NULL,
department_id
INT NOT NULL,
account_id
INT NOT NULL,
PRIMARY KEY (id
),
INDEX fk_staff_department1
(department_id
ASC),
INDEX fk_staff_account1
(account_id
ASC),
CONSTRAINT fk_staff_department1
FOREIGN KEY (department_id
)
REFERENCES mydb
.department
(id
)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT fk_staff_account1
FOREIGN KEY (account_id
)
REFERENCES mydb
.account
(id
)
ON DELETE NO ACTION
ON UPDATE NO ACTION
)
ENGINE = INNODB;
-- Table mydb
.fid
CREATE TABLE IF NOT EXISTS osm2
.fid
(
id
INT NOT NULL,
text
VARCHAR (500) NOT NULL,
comments
VARCHAR (500) NULL,
PRIMARY KEY (id
)
)
ENGINE = INNODB;
-- Table mydb
.group_has_fid
CREATE TABLE IF NOT EXISTS osm2
.group_has_fid
(
group_id
INT NOT NULL,
fid_id
INT NOT NULL,
PRIMARY KEY (group_id
, fid_id
),
INDEX fk_group_has_fid_group1
(group_id
ASC),
INDEX fk_group_has_fid_fid1
(fid_id
ASC),
CONSTRAINT fk_group_has_fid_group1
FOREIGN KEY (group_id
)
REFERENCES mydb
.group
(id
)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT fk_group_has_fid_fid1
FOREIGN KEY (fid_id
)
REFERENCES mydb
.fid
(id
)
ON DELETE NO ACTION
ON UPDATE NO ACTION
)
ENGINE = INNODB;
SET SQL_MODE=@OLD_SQL_MODE; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;