mail[Galette-devel] Groupes


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by Loïs Taulelle on October 27, 2011 - 11:58:
Salut les devz,

Johan, comme tu commence les groupes, et avant que tu ai trop de code,
je te propose les corrections suivantes sur le code SQL/mysql (voir patch).

Ceci avant d'introduire ces mêmes corrections dans la partie pgsql.

Comments welcome :o)

A+, Loïs
-- 
Quand karma faché, karma toujours faire comme ça.
Index: mysql.sql
===================================================================
--- mysql.sql   (révision 1485)
+++ mysql.sql   (copie de travail)
@@ -218,15 +218,15 @@
   PRIMARY KEY (mailing_id)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
 
--- table for groups
-CREATE TABLE IF NOT EXISTS galette_groups (
-  id int(10) NOT NULL AUTO_INCREMENT,
+-- table for groups owner
+CREATE TABLE IF NOT EXISTS galette_groups_owner (
+  id_group int(10) NOT NULL AUTO_INCREMENT,
   group_name varchar(50) COLLATE utf8_unicode_ci NOT NULL,
   creation_date datetime NOT NULL,
-  `owner` int(10) unsigned NOT NULL,
-  PRIMARY KEY (id),
-  UNIQUE KEY `name` (group_name),
-  KEY `owner` (`owner`)
+  id_adh int(10) unsigned NOT NULL,
+  PRIMARY KEY (id_group),
+  UNIQUE KEY `name` (group_name), -- usefull ?
+  FOREIGN KEY (id_adh) REFERENCES galette_adherents (id_adh)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
 
 -- table for groups users
@@ -235,18 +235,8 @@
   id_adh int(10) unsigned NOT NULL,
   manager tinyint(1) NOT NULL DEFAULT '0',
   PRIMARY KEY (id_group,id_adh),
-  KEY id_adh (id_adh)
+  FOREIGN KEY (id_adh) REFERENCES galette_adherents (id_adh),
+  FOREIGN KEY (id_group) REFERENCES galette_groups_owner (id_group)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
 
--- constraints
-
--- group owner
-ALTER TABLE galette_groups
-  ADD CONSTRAINT galette_groups_owner FOREIGN KEY (`owner`) REFERENCES 
galette_adherents (id_adh);
-
--- groups users
-ALTER TABLE galette_groups_users
-  ADD CONSTRAINT galette_groups_users_adh FOREIGN KEY (id_adh) REFERENCES 
galette_adherents (id_adh),
-  ADD CONSTRAINT galette_groups_users_group FOREIGN KEY (id_group) 
REFERENCES galette_groups (id);
-
 SET FOREIGN_KEY_CHECKS=1;

Related Messages


Powered by MHonArc, Updated Thu Oct 27 17:20:08 2011