migrations: fix copy license data in migration 000049
@@ -7,19 +7,23 @@ BEGIN;
UPDATE
packages p
SET
- license_types = l.license_types,
- license_paths = l.license_paths
+ license_types = pl.license_types,
+ license_paths = pl.license_paths
FROM (
SELECT
- module_path,
- version,
+ pl.module_path,
+ pl.version,
+ pl.package_path,
array_agg(l.type ORDER BY l.file_path) FILTER (WHERE l.version IS NOT NULL) AS license_types,
array_agg(l.file_path ORDER BY l.file_path) FILTER (WHERE l.version IS NOT NULL) AS license_paths
FROM licenses l
- GROUP BY 1,2
-) l
+ INNER JOIN package_licenses pl
+ ON pl.module_path=l.module_path AND pl.version=l.version AND pl.file_path=l.file_path
+ GROUP BY 1,2,3
+) pl
WHERE
- p.module_path = l.module_path
- AND p.version = l.version;
+ p.module_path = pl.module_path
+ AND p.version = pl.version
+ AND p.path = pl.package_path;
END;
