Files
mono/mcs/class/System.Data.Linq/examples/DbLinq.MySql.Example/sql/createDB_Andrus.sql
T
Jonathan Pryor 51fe9f0e89 * Makefile: Also rsync dblinq2007/examples sources.
* build/DbLinq.Sqlite_test_mono_strict.dll.sources: Added; .sources
	  file to build build/DbLinq.Sqlite_test_mono_strict.dll, the
	  "end-to-end" unit tests for SQLite using Mono.Data.Sqlite.
	* build/Makefile: Added; builds all "end-to-end" unit tests.
	* examples/**/*: Sync with DbLinq r1217; includes sources needed for
	  end-to-end tests located in 'build'.

svn path=/trunk/mcs/; revision=141365
2009-09-04 20:50:26 +00:00

62 lines
1.9 KiB
SQL

####################################################################
## script to create Andrus DB, a test DB which exercises:
## 1) Composite PKs
## 2) Vertical Partitioning
## 3) some pathological mapping situations (mapping from sql schema to DBML to C#)
## most of these cases were discovered by Andrus (Tallinn, Estonia).
####################################################################
DROP DATABASE IF EXISTS `Andrus`;
CREATE DATABASE `Andrus`;
USE `Andrus`;
## note - LinqUser must already be created.
GRANT Select, Insert, Update, Delete, EXECUTE ON `Andrus`.* TO 'LinqUser'@'%';
FLUSH PRIVILEGES;
# problem 1. foreign key relation generates duplicate propery if property exists.
# problem 2. Column name 'private' causes error
CREATE TABLE t1 ( private int primary key) ENGINE = InnoDB;
## here both columns reference table t1
CREATE TABLE t2 ( f1 int references t1,
f2 int references t1 ) ENGINE = InnoDB;
## a little composite PK playground...
create table tCompositePK
(
f1 int,
f2 varchar(5),
f3 int,
primary key(f1,f2)
)
ENGINE = InnoDB;
## there was a bug where this table could not be updated - quotes missing in the UPDATE statement around the PK.
create table char_pk ( col1 char primary key, val1 int);
## this is for testing of vertical Partitioning / Discriminator.
## EmployeeType controls which derived class we instantiate.
create table Employee
(
employeeID INTEGER NOT NULL AUTO_INCREMENT,
employeeType int NOT NULL,
employeeName varchar(99),
startDate date NULL,
PRIMARY KEY(employeeID)
)
ENGINE = InnoDB;
INSERT INTO Employee (employeeType, employeeName) VALUES (0, 'Pavel');
INSERT INTO Employee (employeeType, employeeName) VALUES (1, 'Piotr');
INSERT INTO Employee (employeeType, employeeName) VALUES (1, 'Jana');
INSERT INTO Employee (employeeType, employeeName) VALUES (2, 'Ladislav');
COMMIT;