Index: l10n_community.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/l10n_server/l10n_community/Attic/l10n_community.install,v
retrieving revision 1.1.2.11.2.7
diff -u -p -r1.1.2.11.2.7 l10n_community.install
--- l10n_community.install	26 Oct 2008 20:56:42 -0000	1.1.2.11.2.7
+++ l10n_community.install	7 Mar 2009 15:28:00 -0000
@@ -170,6 +170,12 @@ function l10n_community_schema() {
         'not null' => FALSE,
         'disp-width' => '11'
       ),
+      'pid' => array(
+        'description' => $t('Reference to the {l10n_community_project}.pid of the parent project.'),
+        'type' => 'int',
+        'not null' => FALSE,
+        'disp-width' => '11'
+      ),
       'location' => array(
         'description' => $t('Path to the file within the release package.'),
         'type' => 'varchar',
@@ -198,6 +204,18 @@ function l10n_community_schema() {
         'not null' => FALSE,
         'disp-width' => '11'
       ),
+      'pid' => array(
+        'description' => $t('Reference to the {l10n_community_project}.pid of the parent project.'),
+        'type' => 'int',
+        'not null' => FALSE,
+        'disp-width' => '11'
+      ),
+      'rid' => array(
+        'description' => $t('Reference to the {l10n_community_release}.rid of the parent release.'),
+        'type' => 'int',
+        'not null' => FALSE,
+        'disp-width' => '11'
+      ),
       'lineno' => array(
         'description' => $t('Number of line where the string occurance was found.'),
         'type' => 'int',
@@ -504,3 +522,35 @@ function l10n_community_update_6004() {
   db_add_index($ret, 'l10n_community_translation', 'sid_language_suggestion', array('sid', 'language', 'is_suggestion'));
   return $ret;
 }
+
+/**
+ * Denormalize data in order to improve performance: Push project ID to file table.
+ */
+function l10n_community_update_6005() {
+  $ret = array();
+
+  db_add_field($ret, 'l10n_community_file', 'pid', array('type' => 'int', 'not null' => FALSE, 'disp-width' => 11));
+
+  $q = db_query("SELECT f.fid, r.pid FROM {l10n_community_release} r, {l10n_community_file} f WHERE r.rid = f.rid");
+  while ($row = db_fetch_object($q)) {
+    db_query("UPDATE {l10n_community_file} SET pid = %d WHERE fid = %d", $row->pid, $row->fid);
+  }
+  return $ret;
+}
+
+/**
+ * Denormalize data in order to improve performance: Push project and release ID to line table.
+ */
+function l10n_community_update_6006() {
+  $ret = array();
+
+  db_add_field($ret, 'l10n_community_line', 'pid', array('type' => 'int', 'not null' => FALSE, 'disp-width' => 11));
+  db_add_field($ret, 'l10n_community_line', 'rid', array('type' => 'int', 'not null' => FALSE, 'disp-width' => 11));
+
+  $q = db_query("SELECT l.lineno, l.fid, l.sid, l.type, f.rid, f.pid FROM {l10n_community_line} l, {l10n_community_file} f WHERE f.fid = l.fid");
+  while ($row = db_fetch_object($q)) {
+    db_query("UPDATE {l10n_community_line} SET pid = %d, rid = %d WHERE fid = %d AND lineno = %d AND type = %d AND sid = %d", $row->pid, $row->rid, $row->fid, $row->lineno, $row->type, $row->sid);
+  }
+  return $ret;
+}
+
