1 pjaol 1.1 CREATE TABLE dependancyType (
2 idDependancyType INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
3 name VARCHAR(20) NULL,
4 PRIMARY KEY(idDependancyType)
5 );
6
7 CREATE TABLE Groups (
8 idGroups INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
9 groupName VARCHAR(20) NULL,
10 PRIMARY KEY(idGroups)
11 )
12 TYPE=InnoDB;
13
14 CREATE TABLE projects (
15 idprojects INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
16 Groups_idGroups INTEGER UNSIGNED NOT NULL,
17 projectName VARCHAR(20) NULL,
18 startDate DATETIME NULL,
19 endDate DATETIME NULL,
20 slipage DATETIME NULL,
21 PRIMARY KEY(idprojects),
22 pjaol 1.1 INDEX projects_FKIndex2(Groups_idGroups),
23 FOREIGN KEY(Groups_idGroups)
24 REFERENCES Groups(idGroups)
25 ON DELETE NO ACTION
26 ON UPDATE NO ACTION
27 )
28 TYPE=InnoDB;
29
30 CREATE TABLE groupUsers (
31 idGroupUsers INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
32 Groups_idGroups INTEGER UNSIGNED NOT NULL,
33 userName VARCHAR(20) NULL,
34 fullName VARCHAR(45) NULL,
35 PRIMARY KEY(idGroupUsers),
36 INDEX groupUsers_FKIndex1(Groups_idGroups),
37 FOREIGN KEY(Groups_idGroups)
38 REFERENCES Groups(idGroups)
39 ON DELETE NO ACTION
40 ON UPDATE NO ACTION
41 )
42 TYPE=InnoDB;
43 pjaol 1.1
44 CREATE TABLE Activity (
45 idActivity INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
46 groupUsers_idGroupUsers INTEGER UNSIGNED NOT NULL,
47 Groups_idGroups INTEGER UNSIGNED NOT NULL,
48 projects_idprojects INTEGER UNSIGNED NOT NULL,
49 activityName VARCHAR(20) NULL,
50 activityDesc VARCHAR(255) NULL,
51 startDate DATETIME NULL,
52 endDate DATETIME NULL,
53 slipage DATETIME NULL,
54 PRIMARY KEY(idActivity),
55 INDEX Activity_FKIndex1(projects_idprojects),
56 INDEX Activity_FKIndex2(Groups_idGroups),
57 INDEX Activity_FKIndex3(groupUsers_idGroupUsers),
58 FOREIGN KEY(projects_idprojects)
59 REFERENCES projects(idprojects)
60 ON DELETE NO ACTION
61 ON UPDATE NO ACTION,
62 FOREIGN KEY(Groups_idGroups)
63 REFERENCES Groups(idGroups)
64 pjaol 1.1 ON DELETE NO ACTION
65 ON UPDATE NO ACTION,
66 FOREIGN KEY(groupUsers_idGroupUsers)
67 REFERENCES groupUsers(idGroupUsers)
68 ON DELETE NO ACTION
69 ON UPDATE NO ACTION
70 )
71 TYPE=InnoDB;
72
73 CREATE TABLE diary (
74 iddiary INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
75 Activity_idActivity INTEGER UNSIGNED NOT NULL,
76 diaryType VARCHAR(20) NULL,
77 description VARCHAR(20) NULL,
78 message VARCHAR(255) NULL,
79 date DATETIME NULL,
80 PRIMARY KEY(iddiary),
81 INDEX diary_FKIndex1(Activity_idActivity),
82 FOREIGN KEY(Activity_idActivity)
83 REFERENCES Activity(idActivity)
84 ON DELETE NO ACTION
85 pjaol 1.1 ON UPDATE NO ACTION
86 );
87
88 CREATE TABLE dependacies (
89 idDependacies INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
90 Activity_idActivity INTEGER UNSIGNED NOT NULL,
91 dependancyType_idDependancyType INTEGER UNSIGNED NOT NULL,
92 PRIMARY KEY(idDependacies),
93 INDEX dependacies_FKIndex1(dependancyType_idDependancyType),
94 INDEX dependacies_FKIndex2(Activity_idActivity),
95 FOREIGN KEY(dependancyType_idDependancyType)
96 REFERENCES dependancyType(idDependancyType)
97 ON DELETE NO ACTION
98 ON UPDATE NO ACTION,
99 FOREIGN KEY(Activity_idActivity)
100 REFERENCES Activity(idActivity)
101 ON DELETE NO ACTION
102 ON UPDATE NO ACTION
103 );
104
105
|