Hieronder staan een aantal tabellen die ik heb opgezet voor een systeem dat projecten aan een aantal mensen moet koppelen. Vanwege normalisatie lijkt het me het beste om die koppeling in een aparte tabel te doen, maar welke variabelen moet ik daarvoor gebruiken? Waar ik niet uitkom is hoe ik meerdere personen aan een project koppel, maar die personen mogen ook weer aan meerdere projecten deelnemen.
Iemand een idee?
# --------------------------------------------------------
#
# Table structure for table 'log'
#
DROP TABLE IF EXISTS log;
CREATE TABLE log (
lid tinyint(3) unsigned NOT NULL auto_increment,
pid tinyint(3) unsigned DEFAULT '0' NOT NULL,
tid tinyint(3) unsigned DEFAULT '0' NOT NULL,
uid tinyint(3) unsigned DEFAULT '0' NOT NULL,
date date DEFAULT '00-00-0000' NOT NULL,
PRIMARY KEY (lid)
);
# --------------------------------------------------------
#
# Table structure for table 'projects'
#
DROP TABLE IF EXISTS projects;
CREATE TABLE projects (
pid smallint(5) unsigned NOT NULL auto_increment,
pname varchar(40) NOT NULL,
pdesc text NOT NULL,
PRIMARY KEY (pid)
);
# --------------------------------------------------------
#
# Table structure for table 'users'
#
DROP TABLE IF EXISTS users;
CREATE TABLE users (
uid tinyint(3) unsigned NOT NULL auto_increment,
uname varchar(255) NOT NULL,
upass varchar(255) NOT NULL,
uperms tinyint(4) DEFAULT '0' NOT NULL,
PRIMARY KEY (uid),
UNIQUE uname (uname)
);
Iemand een idee?
# --------------------------------------------------------
#
# Table structure for table 'log'
#
DROP TABLE IF EXISTS log;
CREATE TABLE log (
lid tinyint(3) unsigned NOT NULL auto_increment,
pid tinyint(3) unsigned DEFAULT '0' NOT NULL,
tid tinyint(3) unsigned DEFAULT '0' NOT NULL,
uid tinyint(3) unsigned DEFAULT '0' NOT NULL,
date date DEFAULT '00-00-0000' NOT NULL,
PRIMARY KEY (lid)
);
# --------------------------------------------------------
#
# Table structure for table 'projects'
#
DROP TABLE IF EXISTS projects;
CREATE TABLE projects (
pid smallint(5) unsigned NOT NULL auto_increment,
pname varchar(40) NOT NULL,
pdesc text NOT NULL,
PRIMARY KEY (pid)
);
# --------------------------------------------------------
#
# Table structure for table 'users'
#
DROP TABLE IF EXISTS users;
CREATE TABLE users (
uid tinyint(3) unsigned NOT NULL auto_increment,
uname varchar(255) NOT NULL,
upass varchar(255) NOT NULL,
uperms tinyint(4) DEFAULT '0' NOT NULL,
PRIMARY KEY (uid),
UNIQUE uname (uname)
);
I love it when a plan comes together!