Home | History | Annotate | Line # | Download | only in mysql
      1 drop table if exists persons;
      2 CREATE 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 
      9 drop table if exists institutes;
     10 CREATE TABLE institutes (
     11 	id int NOT NULL,
     12 	name varchar(255)
     13 );
     14 
     15 drop table if exists documents;
     16 CREATE TABLE documents (
     17 	id int NOT NULL,
     18 	title varchar(255) NOT NULL,
     19 	abstract varchar(255)
     20 );
     21 
     22 drop table if exists authors_docs;
     23 CREATE TABLE authors_docs (
     24 	pers_id int NOT NULL,
     25 	doc_id int NOT NULL
     26 );
     27 
     28 drop table if exists phones;
     29 CREATE TABLE phones (
     30 	id int NOT NULL ,
     31 	phone varchar(255) NOT NULL ,
     32 	pers_id int NOT NULL 
     33 );
     34 
     35 drop table if exists certs;
     36 CREATE TABLE certs (
     37 	id int NOT NULL ,
     38 	cert LONGBLOB NOT NULL,
     39 	pers_id int NOT NULL 
     40 );
     41 
     42 ALTER TABLE authors_docs  ADD 
     43 	CONSTRAINT PK_authors_docs PRIMARY KEY  
     44 	(
     45 		pers_id,
     46 		doc_id
     47 	);
     48 
     49 ALTER TABLE documents  ADD 
     50 	CONSTRAINT PK_documents PRIMARY KEY  
     51 	(
     52 		id
     53 	); 
     54 
     55 ALTER TABLE institutes  ADD 
     56 	CONSTRAINT PK_institutes PRIMARY KEY  
     57 	(
     58 		id
     59 	);  
     60 
     61 
     62 ALTER TABLE persons  ADD 
     63 	CONSTRAINT PK_persons PRIMARY KEY  
     64 	(
     65 		id
     66 	); 
     67 
     68 ALTER TABLE phones  ADD 
     69 	CONSTRAINT PK_phones PRIMARY KEY  
     70 	(
     71 		id
     72 	); 
     73 
     74 ALTER TABLE certs  ADD 
     75 	CONSTRAINT PK_certs PRIMARY KEY  
     76 	(
     77 		id
     78 	); 
     79 
     80 drop table if exists referrals;
     81 CREATE TABLE referrals (
     82 	id int NOT NULL,
     83 	name varchar(255) NOT NULL,
     84 	url varchar(255) NOT NULL
     85 );
     86 
     87