Thread neues Board: Datenmodell (23 answers)
Opened by Strat at 2003-10-03 12:39

Strat
 2003-10-02 01:00
#38490 #38490
User since
2003-08-04
5246 Artikel
ModeratorIn
[Homepage] [default_avatar]
Hallo Leute,

habe hier mal ein Datenmodell fuer das neue Board erstellt. Bitte um Kritik:
[sql]#
# Tabellenstruktur für Tabelle `pb_boards`
#

DROP TABLE IF EXISTS pb_boards;
CREATE TABLE pb_boards (
 id int(10) unsigned NOT NULL auto_increment,
 name char(20) NOT NULL default '',
 description char(50) NOT NULL default '''''',
 position int(10) unsigned NOT NULL default '0',
 parentId int(10) unsigned default NULL,
 containMessages enum('y','n') NOT NULL default 'y',
 groupRequired int(10) unsigned default NULL,
 PRIMARY KEY  (id)
) TYPE =MyISAM COMMENT ='boards names';

#
# Daten für Tabelle `pb_boards`
#

# ------------------------------------------------------- -

#
# Tabellenstruktur für Tabelle `pb_lang_de`
#

DROP TABLE IF EXISTS pb_lang_de;
CREATE TABLE pb_lang_de (
 shortcut varchar(30) NOT NULL default '',
 text varchar(255) NOT NULL default '',
 PRIMARY KEY  (shortcut)
) TYPE =MyISAM COMMENT ='german language settings';

#
# Daten für Tabelle `pb_lang_de`
#

# ------------------------------------------------------- -

#
# Tabellenstruktur für Tabelle `pb_languages`
#

DROP TABLE IF EXISTS pb_languages;
CREATE TABLE pb_languages (
 code char(4) NOT NULL default '',
 description char(10) NOT NULL default '',
 table char(16) NOT NULL default '',
 PRIMARY KEY  (code)
) TYPE =MyISAM COMMENT ='Languages';

#
# Daten für Tabelle `pb_languages`
#

# ------------------------------------------------------- -

#
# Tabellenstruktur für Tabelle `pb_messages`
#

DROP TABLE IF EXISTS pb_messages;
CREATE TABLE pb_messages (
 thread bigint(20) unsigned NOT NULL default '0',
 position int(10) unsigned NOT NULL default '0',
 authorId int(10) unsigned NOT NULL default '0',
 boardId int(10) unsigned NOT NULL default '0',
 message_raw text NOT NULL,
 message_preview text,
 posttime date NOT NULL default '0000-00 -00',
 lastedit date default NULL,
 lasteditor int(10) unsigned default NULL,
 status enum('none','deleted') NOT NULL default 'none',
 PRIMARY KEY  (thread,position)
) TYPE =MyISAM COMMENT ='messages';

#
# Daten für Tabelle `pb_messages`
#

# ------------------------------------------------------- -

#
# Tabellenstruktur für Tabelle `pb_threads`
#

DROP TABLE IF EXISTS pb_threads;
CREATE TABLE pb_threads (
 id bigint(20) unsigned NOT NULL auto_increment,
 title varchar(30) NOT NULL default '',
 status set('fixed','deleted','closed','open') NOT NULL default 'open',
 readCount int(10) unsigned NOT NULL default '0',
 lastAction timestamp(14) NOT NULL,
 PRIMARY KEY  (id)
) TYPE =MyISAM COMMENT ='Thread headlines';

#
# Daten für Tabelle `pb_threads`
#

# ------------------------------------------------------- -

#
# Tabellenstruktur für Tabelle `pb_user`
#

DROP TABLE IF EXISTS pb_user;
CREATE TABLE pb_user (
 id int(10) unsigned NOT NULL auto_increment,
 nick char(10) NOT NULL default '',
 password char(32) NOT NULL default '',
 PRIMARY KEY  (id)
) TYPE =MyISAM COMMENT ='User und Passwoerter';

#
# Daten für Tabelle `pb_user`
#

INSERT INTO pb_user (id, nick, password) VALUES (1, 'Gast', '' );
# ------------------------------------------------------- -

#
# Tabellenstruktur für Tabelle `pb_user_groups`
#

DROP TABLE IF EXISTS pb_user_groups;
CREATE TABLE pb_user_groups (
 groupId int(10) unsigned NOT NULL auto_increment,
 groupName char(20) NOT NULL default '',
 level enum('guest','user','moderator','admin') NOT NULL default 'user',
 PRIMARY KEY  (groupId)
) TYPE =MyISAM COMMENT ='group names';

#
# Daten für Tabelle `pb_user_groups`
#

INSERT INTO pb_user_groups (groupId, groupName, level) VALUES (1, 'Gast', 'guest');
INSERT INTO pb_user_groups (groupId, groupName, level) VALUES (2, 'User', 'user');
INSERT INTO pb_user_groups (groupId, groupName, level) VALUES (3, 'Moderator', 'moderator');
INSERT INTO pb_user_groups (groupId, groupName, level) VALUES (4, 'Administrator', 'admin');
# ------------------------------------------------------- -

#
# Tabellenstruktur für Tabelle `pb_user_profile`
#

DROP TABLE IF EXISTS pb_user_profile;
CREATE TABLE pb_user_profile (
 id int(10) unsigned NOT NULL default '0',
 name char(30) NOT NULL default '',
 email char(50) NOT NULL default '',
 homepage char(50) NOT NULL default '',
 signature char(100) NOT NULL default '',
 imageurl char(100) NOT NULL default '',
 sex enum('m','f') default NULL,
 interests char(200) NOT NULL default '',
 comment char(100) NOT NULL default '',
 birthday datetime default NULL,
 PRIMARY KEY  (id)
) TYPE =MyISAM COMMENT ='Userprofile';

#
# Daten für Tabelle `pb_user_profile`
#

INSERT INTO pb_user_profile (id, name, email, homepage, signature, imageurl, sex, interests, comment, birthday) VALUES (1, 'Gast', 'nobody@no.org', ' <a href =" <a href ="<a href ="http://www.perl/" target ="_blank">http://www.perl/"</a> target="_blank" ><a href="http://www.perl/</a >" target="_blank">http://www.perl/</a></a> -community.de/'," target="_blank" ><a href ="<a href ="http://www.perl/" target ="_blank">http://www.perl/"</a> target="_blank" ><a href="http://www.perl/</a >" target="_blank">http://www.perl/</a></a> -community.de/',</a > 'Nicht registrierter User', '', NULL, '\'\'', '\'\'', NULL);
# ------------------------------------------------------- -

#
# Tabellenstruktur für Tabelle `pb_user_settings`
#

DROP TABLE IF EXISTS pb_user_settings;
CREATE TABLE pb_user_settings (
 id int(10) unsigned NOT NULL default '0',
 sessionId char(200) NOT NULL default '',
 lastlogon date NOT NULL default '0000-00 -00',
 lastaction timestamp(14) NOT NULL,
 languagecode char(3) NOT NULL default 'de',
 showimages enum('y','n') NOT NULL default 'y',
 cssStylesheet char(40) default NULL,
 postcount int(10) unsigned NOT NULL default '0',
 registerDate date NOT NULL default '0000-00 -00',
 group int(11) default NULL,
 showEmail enum('y','n') NOT NULL default 'y',
 PRIMARY KEY  (id),
 KEY sessionId (sessionId)
) TYPE =MyISAM COMMENT ='Usersettings';

#
# Daten für Tabelle `pb_user_settings`
#

INSERT INTO pb_user_settings (id, sessionId, lastlogon, lastaction, languagecode, showimages, cssStylesheet, postcount, registerDate, group, showEmail) VALUES (1, '', '0000-00 -00', 00000000000000, 'de', 'y', NULL, 0, '0000-00 -00', 1, 'n' );
[/sql]\n\n

<!--EDIT|Strat|1065042148-->
perl -le "s::*erlco'unaty.'.dk':e,y;*kn:ai;penmic;;print"
http://www.fabiani.net/

View full thread neues Board: Datenmodell