diff options
author | Erich Eckner <git@eckner.net> | 2018-02-11 14:00:34 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-02-11 14:00:34 +0100 |
commit | 8a47d8320876599924e73a75a33c8fe3d20dc163 (patch) | |
tree | 13ea5f9b6434fcd1b0b1ca33a89e9a4406a91842 /bin/db-update | |
parent | cb6e59fd1e31842425b06722d99b57774fa4e49c (diff) | |
download | builder-8a47d8320876599924e73a75a33c8fe3d20dc163.tar.xz |
bin/db-update: fix mysql expression - tables should have distinct names
Diffstat (limited to 'bin/db-update')
-rwxr-xr-x | bin/db-update | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/bin/db-update b/bin/db-update index 9662ec4..f5ec07a 100755 --- a/bin/db-update +++ b/bin/db-update @@ -329,15 +329,19 @@ move_packages() { while read -r package; do while read -r part; do printf 'UPDATE `binary_packages`' - printf ' JOIN `repositories` ON `binary_packages`.`repository`=`repositories`.`id`' + printf ' JOIN `repositories` AS `from_repo` ON `binary_packages`.`repository`=`from_repo`.`id`' printf ' JOIN `architectures` ON `binary_packages`.`architecture`=`architectures`.`id`' - printf ' SET `binary_packages`.`repository`=(SELECT `repositories`.`id` FROM `repositories` WHERE `repositories`.`name`=from_base64("%s"))' \ - "$( - base64_encode_each < \ - "${tmp_dir}/tmp/${package}.to_repo" - )" + printf ' SET `binary_packages`.`repository`=(' + printf 'SELECT `to_repo`.`id`' + printf ' FROM `repositories` as `to_repo`' + printf ' WHERE `to_repo`.`name`=from_base64("%s")' \ + "$( + base64_encode_each < \ + "${tmp_dir}/tmp/${package}.to_repo" + )" + printf ')' printf ' WHERE' - printf ' `repositories`.`name`=from_base64("%s")' \ + printf ' `from_repo`.`name`=from_base64("%s")' \ "$( base64_encode_each < \ "${tmp_dir}/tmp/${package}.from_repo" |