mysqlsqlschema
why these statements are wrong ?
these statements are auto generated by mysql workbench
-- mysql workbench forward engineering
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,allow_invalid_dates';
-- schema sysbasedata
-- schema sysbasedata
create schema if not exists sysbasedata default character set utf8 collate utf8_general_ci ;
show warnings;
use sysbasedata ;
-- table sysbasedata.instruments
create table if not exists sysbasedata.instruments (
instrumentid char(32) not null,
exchangeid char(12) not null,
instrumentname char(24) null,
primary key (instrumentid, exchangeid))
engine = innodb;
show warnings;
-- table sysbasedata.ordersgroups
create table if not exists sysbasedata.ordersgroups (
ordergroup int not null,
orderref char(16) not null,
tradingday date not null,
primary key (orderref, tradingday, ordergroup))
engine = innodb;
show warnings;
-- table sysbasedata.errororderrecords
create table if not exists sysbasedata.errororderrecords (
instrumentid char(32) null,
exchangeid char(12) null,
orderpricetype char null,
direction char null,
limitprice char(16) null,
volumetotaloriginal int null,
errormsg char(255) null,
ordergroup int not null,
orderref char(16) not null,
tradingday date not null,
primary key (tradingday, orderref, ordergroup),
constraint fk_errororderrecords_1
foreign key (tradingday , orderref , ordergroup)
references sysbasedata.ordersgroups (tradingday , orderref , ordergroup)
on delete no action
on update no action)
engine = innodb;
show warnings;
set sql_mode=@old_sql_mode;
set foreign_key_checks=@old_foreign_key_checks;
set unique_checks=@old_unique_checks;