/dd/ -> 0_0022_inc.php
1 <?php
2
3 // 0_0022_inc.php - defines antibody related tables
4 // 0_0022_inc.php - author: Nico Stuurman <nicost@sourceforge.net>
5
6 /***************************************************************************
7 * Copyright (c) 2001 by Nico Stuurman *
8 * ------------------------------------------------------------------------ *
9 * Creates tables protocols,pr_type1, and inserts initial values *
10 * *
11 * *
12 * *
13 * This program is free software; you can redistribute it and/or modify it *
14 * under the terms of the GNU General Public License as published by the *
15 * Free Software Foundation; either version 2 of the License, or (at your *
16 * option) any later version. *
17 \**************************************************************************/
18
19
20 $query="CREATE TABLE protocols (
21 id int PRIMARY KEY,
22 access char(9),
23 ownerid int,
24 magic int,
25 title text,
26 type1 int,
27 type2 int,
28 notes text,
29 lastmodby int,
30 lastmoddate int,
31 date int)";
32 if (!$db->Execute($query)) $test=false;
33 $db->Execute("CREATE INDEX protocols_id_index ON protocols (id)");
34 $db->Execute("CREATE INDEX protocols_ownerid_index ON protocols (ownerid)");
35 $db->Execute("CREATE INDEX protocols_date_index ON protocols (date)");
36 $db->Execute("CREATE INDEX protocols_magic_index ON protocols (magic)");
37 $db->Execute("CREATE INDEX protocols_name_index ON protocols (title)");
38 $db->Execute("CREATE INDEX protocols_name_index ON protocols (title(10))");
39 $query="CREATE TABLE pr_type1
40 (id int PRIMARY KEY,
41 sortkey int,
42 type text,
43 typeshort text)";
44 if (!$db->Execute($query)) $test=false;
45 $db->Execute("CREATE INDEX pr_type1_id_index ON pr_type1 (id)");
46 $db->Execute("CREATE INDEX pr_type1_sortkey_index ON pr_type1 (sortkey)");
47 $query="CREATE TABLE pr_type2
48 (id int PRIMARY KEY,
49 sortkey int,
50 type text,
51 typeshort text)";
52 if (!$db->Execute($query)) $test=false;
53 $db->Execute("CREATE INDEX pr_type2_id_index ON pr_type2 (id)");
54 $db->Execute("CREATE INDEX pr_type2_sortkey_index ON pr_type2 (sortkey)");
55
56 $tablesid=$db->GenID("tableoftables_id_seq");
57 $query="INSERT INTO tableoftables VALUES ($tablesid,200,'protocols','pr')";
58 if (!$db->Execute($query)) $test=false;
59
60 $query="ALTER TABLE files ADD COLUMN type text";
61 if (!$db->Execute($query)) $test=false;
62
63 ?>