/[glsr]/trunk/setup/schema/mysql.schema
Gentoo

Contents of /trunk/setup/schema/mysql.schema

Parent Directory Parent Directory | Revision Log Revision Log


Revision 24 - (show annotations) (download)
Thu Jun 30 05:18:08 2005 UTC (12 years, 11 months ago) by hadfield
File size: 5343 byte(s)
imported domain_modules package and setup package from the src-whoa cvs tree
1 # Copyright 2005 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 #
4 # $Id$
5 #
6 # This is the mysql schema template for the script repository. It isn't
7 # actually a valid mysql schema but is parsed, compiled, and loaded into the
8 # mysql db by setup.py .
9 #
10
11 CREATE DATABASE {DB_NAME};
12
13 CREATE TABLE {TBL_PREFIX}user (
14 user_id MEDIUMINT(5) unsigned NOT NULL auto_increment,
15 user_alias VARCHAR(25) NOT NULL,
16 user_fullname VARCHAR(40) NOT NULL,
17 user_passwd VARCHAR(32) NOT NULL,
18 user_email VARCHAR(50) NOT NULL,
19 user_rank MEDIUMINT(5) NOT NULL default '0',
20 user_type TINYINT(1) unsigned NOT NULL default '0',
21 user_joined DATE NOT NULL,
22 user_lastip VARCHAR(15) NULL,
23 user_language VARCHAR(100) NULL,
24 user_location VARCHAR(100) NULL,
25 user_website VARCHAR(100) NULL,
26 PRIMARY KEY(user_id),
27 KEY user_id(user_id)
28 );
29
30 CREATE TABLE {TBL_PREFIX}category (
31 category_id SMALLINT(3) unsigned NOT NULL auto_increment,
32 category_name VARCHAR(50) NOT NULL,
33 category_descr VARCHAR(100) NULL,
34 category_parent_id SMALLINT(3) unsigned NOT NULL default '0',
35 PRIMARY KEY(category_id),
36 KEY category_id(category_id)
37 );
38
39 #
40 # Language Table
41 # This table stores programming languages and their settings.
42 #
43 CREATE TABLE {TBL_PREFIX}language (
44 language_id SMALLINT(3) unsigned NOT NULL auto_increment,
45 language_name VARCHAR(50) NOT NULL,
46 language_descr VARCHAR(100) NULL,
47 language_def_keywords VARCHAR(100) NULL,
48 language_def_expr VARCHAR(100) NULL,
49 language_clo_expr VARCHAR(100) NULL,
50 language_clo_s_keywords VARCHAR(100) NULL,
51 PRIMARY KEY(language_id),
52 KEY language_id(language_id)
53 );
54
55 #
56 # Comment Table
57 # The comment table contains user submitted comments to scripts.
58 #
59 CREATE TABLE {TBL_PREFIX}comment (
60 comment_id MEDIUMINT(6) unsigned NOT NULL auto_increment,
61 comment_submitter_id MEDIUMINT(5) unsigned NOT NULL,
62 comment_script_id MEDIUMINT(6) unsigned NOT NULL,
63 comment_subscript_id INT(10) unsigned NULL,
64 comment_date DATETIME NULL,
65 comment_lastedited DATETIME NULL,
66 comment_subject VARCHAR(30) NULL,
67 comment_body TEXT NOT NULL,
68 PRIMARY KEY(comment_id),
69 KEY comment_id(comment_id)
70 );
71
72 CREATE TABLE {TBL_PREFIX}script (
73 script_id MEDIUMINT(7) unsigned NOT NULL auto_increment,
74 script_submitter_id MEDIUMINT(5) unsigned NOT NULL,
75 script_category_id SMALLINT(3) unsigned NOT NULL,
76 script_language_id SMALLINT(3) unsigned NOT NULL,
77 script_rank TINYINT(1) NOT NULL default '0',
78 script_name VARCHAR(30) NOT NULL,
79 script_descr VARCHAR(100) NOT NULL,
80 PRIMARY KEY(script_id),
81 KEY script_id(script_id)
82 );
83
84 CREATE TABLE {TBL_PREFIX}subscript (
85 subscript_id INT(10) unsigned NOT NULL auto_increment,
86 subscript_parent_id MEDIUMINT(7) unsigned NOT NULL,
87 subscript_version VARCHAR(10) NOT NULL,
88 subscript_body TEXT NOT NULL,
89 subscript_changelog TEXT NOT NULL,
90 subscript_date DATETIME NULL,
91 subscript_status ENUM('draft', 'pending', 'published') DEFAULT 'draft',
92 subscript_approved TINYINT(1) NOT NULL default '-1',
93 subscript_approvedby MEDIUMINT(5) unsigned NULL,
94 PRIMARY KEY(subscript_id),
95 KEY subscript_id(subscript_id)
96 );
97
98 CREATE TABLE {TBL_PREFIX}session (
99 session_id VARCHAR(30) NOT NULL,
100 session_user_id MEDIUMINT(5) unsigned NOT NULL,
101 session_time INT(10) NOT NULL,
102 session_keep TINYINT(1) unsigned NOT NULL default '0',
103 session_restrict TINYINT(1) unsigned NOT NULL default '0',
104 PRIMARY KEY(session_id),
105 KEY session_id(session_id)
106 );
107
108 #
109 # News Table
110 # This table stores news items that will be displayed on the front page
111 # of the repository when users visit the site.
112 #
113 CREATE TABLE {TBL_PREFIX}news (
114 news_id INT(10) unsigned NOT NULL auto_increment,
115 news_author_id MEDIUMINT(5) unsigned NOT NULL,
116 news_date DATETIME NOT NULL,
117 news_subject VARCHAR(100) NOT NULL,
118 news_body TEXT NOT NULL,
119 PRIMARY KEY(news_id),
120 KEY news_id(news_id)
121 );
122
123 CREATE TABLE {TBL_PREFIX}state (
124 state_table_opt DATE NOT NULL
125 );
126
127 ###############################################################################
128 # Data Insertions
129 # Do not modify the begin/end comments as they are used by the setup script as
130 # guides for data parsing.
131
132 # begin state-data-insert
133 INSERT INTO {TBL_PREFIX}state SET state_table_opt = now();
134 # end state-data-insert
135
136 # begin language-data-insert
137 {LOOP LANGUAGE_LOOP}
138 INSERT INTO {TBL_PREFIX}language (language_name, language_descr, language_def_keywords, language_def_expr, language_clo_expr, language_clo_s_keywords) VALUES ({LANGUAGE_LOOP.name}, {LANGUAGE_LOOP.descr}, {LANGUAGE_LOOP.def_keywords}, {LANGUAGE_LOOP.def_expr}, {LANGUAGE_LOOP.clo_expr}, {LANGUAGE_LOOP.clo_s_keywords});
139 {!LOOP}
140 # end language-data-insert
141
142 # begin user-data-insert
143 {LOOP USER_LOOP}
144 INSERT INTO {TBL_PREFIX}user (user_alias, user_fullname, user_passwd, user_email, user_rank, user_type, user_joined) VALUES ('{USER_LOOP.alias}', '{USER_LOOP.fullname}', PASSWORD('{USER_LOOP.passwd}'), '{USER_LOOP.email}', '{USER_LOOP.type}', '{USER_LOOP.rank}', now())
145 {!LOOP}
146 # end user-data-insert

Properties

Name Value
svn:keywords Id

  ViewVC Help
Powered by ViewVC 1.1.20