summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/bootstrap-mysql27
-rw-r--r--misc/database-layout.dump28
2 files changed, 54 insertions, 1 deletions
diff --git a/bin/bootstrap-mysql b/bin/bootstrap-mysql
index 46f64f3..07e5f7d 100755
--- a/bin/bootstrap-mysql
+++ b/bin/bootstrap-mysql
@@ -304,6 +304,33 @@ fi
printf 'UNTIL row_count_saved=0\n'
printf 'END REPEAT;\n'
+ # we now need to remove the replaced_bpir which are not actually to be
+ # replaced, but simply hidden
+
+ # refresh copies of our temporary tables *yuck*
+ for table in 'replaced' 'moveable'; do
+ for copy in '' '2'; do
+ if [ "${table}" = 'moveable' ] && \
+ [ "${copy}" = '2' ]; then
+ continue
+ fi
+ printf 'DELETE FROM `%s_bpir_copy%s`;\n' "${table}" "${copy}"
+ printf 'INSERT IGNORE INTO `%s_bpir_copy%s`' "${table}" "${copy}"
+ printf ' SELECT `%s_bpir`.*' "${table}"
+ printf ' FROM `%s_bpir`;\n' "${table}"
+ done
+ done
+
+ printf 'DELETE `replaced_bpir` FROM `replaced_bpir`'
+ printf ' JOIN `moveable_bpir`'
+ printf ' ON `replaced_bpir`.`replaced_by`=`moveable_bpir`.`id`'
+ printf ' JOIN `binary_packages_in_repositories` AS `r_bpir`'
+ printf ' ON `replaced_bpir`.`id`=`r_bpir`.`id`'
+ mysql_join_binary_packages_in_repositories_repositories 'r_bpir' 'r_r'
+ printf ' JOIN `repositories` AS `m_to_r`'
+ printf ' ON `m_to_r`.`id`=`moveable_bpir`.`to_repository`'
+ printf ' WHERE `m_to_r`.`stability`!=`r_r`.`stability`;\n'
+
for table in 'moveable' 'replaced'; do
for copy in '' '2'; do
if [ "${table}" = 'moveable' ] && \
diff --git a/misc/database-layout.dump b/misc/database-layout.dump
index 46f4814..c1d8dd1 100644
--- a/misc/database-layout.dump
+++ b/misc/database-layout.dump
@@ -115,7 +115,7 @@ SELECT 1
JOIN `binary_packages` AS `sup_bp`
ON `sup_bpir`.`package`=`sup_bp`.`id`
JOIN `repositories` AS `sup_r`
- ON `sup_bp`.`repository`=`sup_r`.`id`
+ ON `sup_bpir`.`repository`=`sup_r`.`id`
JOIN `repository_stability_relations` AS `rsr_b`
ON `rsr_b`.`less_stable`=`sup_r`.`stability`
WHERE `sup_bp`.`pkgname`=`m_bp`.`pkgname` AND `sup_r`.`architecture`=`m_to_r`.`architecture` AND `rsr_b`.`more_stable`=`r_r`.`stability`);
@@ -280,6 +280,32 @@ SELECT 1
SET row_count_saved = row_count_saved + ROW_COUNT();
UNTIL row_count_saved=0
END REPEAT;
+DELETE
+ FROM `replaced_bpir_copy`;
+INSERT IGNORE INTO `replaced_bpir_copy`
+ SELECT `replaced_bpir`.*
+ FROM `replaced_bpir`;
+DELETE
+ FROM `replaced_bpir_copy2`;
+INSERT IGNORE INTO `replaced_bpir_copy2`
+ SELECT `replaced_bpir`.*
+ FROM `replaced_bpir`;
+DELETE
+ FROM `moveable_bpir_copy`;
+INSERT IGNORE INTO `moveable_bpir_copy`
+ SELECT `moveable_bpir`.*
+ FROM `moveable_bpir`;
+DELETE `replaced_bpir`
+ FROM `replaced_bpir`
+ JOIN `moveable_bpir`
+ ON `replaced_bpir`.`replaced_by`=`moveable_bpir`.`id`
+ JOIN `binary_packages_in_repositories` AS `r_bpir`
+ ON `replaced_bpir`.`id`=`r_bpir`.`id`
+ JOIN `repositories` AS `r_r`
+ ON `r_bpir`.`repository`=`r_r`.`id`
+ JOIN `repositories` AS `m_to_r`
+ ON `m_to_r`.`id`=`moveable_bpir`.`to_repository`
+ WHERE `m_to_r`.`stability`!=`r_r`.`stability`;
DROP TEMPORARY TABLE `moveable_bpir_copy`;
DROP TEMPORARY TABLE `replaced_bpir_copy`;
DROP TEMPORARY TABLE `replaced_bpir_copy2`;