hi,
einen hab i noch ;)
MySQL 5
Da mich die derzeitige aufteilung meiner DB nicht fröhlich stimmt, möchte ich das ganze neu gestalten und bei Gelegenheit auch versuchen, dass ganze zu Normalisieren.
Da ich generell nicht wirklich viel von der Theorie der Normalisierung verstehe, habe ich einfach mal was nach meinem verständnis zusammen gestellt.
Es geht um ein ganz Simples CMS; hier mal meine Idee zum Tabellen-Design.
--
-- Tabellenstruktur für Tabelle `my_head`
--
CREATE TABLE IF NOT EXISTS `my_head` (
`id` int(8) unsigned NOT NULL auto_increment,
`my_title` varchar(200) collate utf8_unicode_ci NOT NULL,
`my_description` varchar(250) collate utf8_unicode_ci NOT NULL,
`my_keywords` varchar(250) collate utf8_unicode_ci NOT NULL,
`my_last_update` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`my_styles_scripts` longtext collate utf8_unicode_ci NOT NULL,
`my_autor` varchar(200) collate utf8_unicode_ci NOT NULL,
`my_autor_email` varchar(200) collate utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`),
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=0 ;
INSERT INTO `my_head` (`id`, `my_title`, `my_description`, `my_keywords`, `my_last_update`, `my_styles_scripts`, `my_autor`, `my_autor_email`)
VALUES
('', '', '', '', '', '', '', '');
-- -------------------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `my_content`
--
CREATE TABLE IF NOT EXISTS `my_content` (
`id` int(8) unsigned NOT NULL auto_increment,
`my_body_id` varchar(200) collate utf8_unicode_ci NOT NULL,
`my_headline` varchar(250) collate utf8_unicode_ci NOT NULL,
`my_content` longtext collate utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`),
FULLTEXT KEY `my_content` (`my_content`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=0 ;
INSERT INTO `my_content` (`id`, `my_body_id`, `my_headline`, `my_content`)
VALUES
('', '', '', '');
-- -------------------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `my_menu`
--
CREATE TABLE IF NOT EXISTS `my_menu` (
`id` int(8) unsigned NOT NULL auto_increment,
`my_link_name` varchar(200) collate utf8_unicode_ci NOT NULL,
`my_link_target` varchar(200) collate utf8_unicode_ci NOT NULL,
`my_link_gruppe` varchar(200) collate utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`),
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=0 ;
INSERT INTO `my_menu` (`id`, `my_link_name`, `my_link_target`, `my_link_gruppe`)
VALUES
('', '', '', '');
-- -------------------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `my_sub_menu`
--
CREATE TABLE IF NOT EXISTS `my_sub_menu` (
`id` int(8) unsigned NOT NULL auto_increment,
`my_link_name` varchar(200) collate utf8_unicode_ci NOT NULL,
`my_link_target` varchar(200) collate utf8_unicode_ci NOT NULL,
`my_link_is_tree` varchar(200) collate utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`),
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=0 ;
INSERT INTO `my_sub_menu` (`id`, `my_link_name`, `my_link_target`, `my_link_is_tree`)
VALUES
('', '', '', '');
-- -------------------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `my_menu_linking`
-- Verknüpfung der Menupunkte
CREATE TABLE IF NOT EXISTS `my_menu_linking` (
`id` int(8) unsigned NOT NULL auto_increment,
`my_menu_id` int(8) NOT NULL,
`my_sub_menu_id` int(8) NOT NULL,
`my_menu_update` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=0 ;
INSERT INTO `my_menu_linking` (`id`, `my_menu_id`, `my_sub_menu_id`)
VALUES
('', '', '');
-- -------------------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `my_content_linking`
-- Verknüpfung der Inhalte und Menu IDs
CREATE TABLE IF NOT EXISTS `my_content_linking` (
`id` int(8) unsigned NOT NULL auto_increment,
`my_head_id` int(8) NOT NULL,
`my_content_id` int(8) NOT NULL,
`my_menu_id` int(8) NOT NULL,
`my_sub_menu_id` int(8) NOT NULL,
PRIMARY KEY (`id`),
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=0 ;
INSERT INTO `my_menu_linking` (`id`, `my_head_id`, `my_content_id`, `my_menu_id`, `my_sub_menu_id`)
VALUES
('', '', '', '', '');
Taugt das was? Kann man das als Halbwegs gut bezeichnen?
Ein Paar Tipps zur Wahl der richtigen Felder (varchar, int, longtext) sind natürlich willkommen.
mfg
--
„Wenn du nicht bereit bist, dafür zu sterben, dann streiche das Wort »Freiheit« aus deinem Vokabular.“ -- Malcolm X
I Have a Dream
„Wenn du nicht bereit bist, dafür zu sterben, dann streiche das Wort »Freiheit« aus deinem Vokabular.“ -- Malcolm X
I Have a Dream