xref: /netbsd-src/external/bsd/openldap/dist/servers/slapd/back-sql/rdbms_depend/mysql/testdb_create.sql (revision 2de962bd804263c16657f586aa00f1704045df8e)
1drop table if exists persons;
2CREATE TABLE persons (
3	id int NOT NULL,
4	name varchar(255) NOT NULL,
5	surname varchar(255) NOT NULL,
6	password varchar(64)
7);
8
9drop table if exists institutes;
10CREATE TABLE institutes (
11	id int NOT NULL,
12	name varchar(255)
13);
14
15drop table if exists documents;
16CREATE TABLE documents (
17	id int NOT NULL,
18	title varchar(255) NOT NULL,
19	abstract varchar(255)
20);
21
22drop table if exists authors_docs;
23CREATE TABLE authors_docs (
24	pers_id int NOT NULL,
25	doc_id int NOT NULL
26);
27
28drop table if exists phones;
29CREATE TABLE phones (
30	id int NOT NULL ,
31	phone varchar(255) NOT NULL ,
32	pers_id int NOT NULL
33);
34
35drop table if exists certs;
36CREATE TABLE certs (
37	id int NOT NULL ,
38	cert LONGBLOB NOT NULL,
39	pers_id int NOT NULL
40);
41
42ALTER TABLE authors_docs  ADD
43	CONSTRAINT PK_authors_docs PRIMARY KEY
44	(
45		pers_id,
46		doc_id
47	);
48
49ALTER TABLE documents  ADD
50	CONSTRAINT PK_documents PRIMARY KEY
51	(
52		id
53	);
54
55ALTER TABLE institutes  ADD
56	CONSTRAINT PK_institutes PRIMARY KEY
57	(
58		id
59	);
60
61
62ALTER TABLE persons  ADD
63	CONSTRAINT PK_persons PRIMARY KEY
64	(
65		id
66	);
67
68ALTER TABLE phones  ADD
69	CONSTRAINT PK_phones PRIMARY KEY
70	(
71		id
72	);
73
74ALTER TABLE certs  ADD
75	CONSTRAINT PK_certs PRIMARY KEY
76	(
77		id
78	);
79
80drop table if exists referrals;
81CREATE TABLE referrals (
82	id int NOT NULL,
83	name varchar(255) NOT NULL,
84	url varchar(255) NOT NULL
85);
86
87