zerobyte/app/drizzle/0026_migrate-local-repo-paths.sql
Nicolas Meienberger 52a6ed6070
Some checks failed
Release Workflow / determine-release-type (push) Has been cancelled
Release Workflow / build-images (push) Has been cancelled
Release Workflow / publish-release (push) Has been cancelled
refactor: import local repositories use path only and not name
2025-12-26 17:29:42 +01:00

10 lines
566 B
SQL

-- Migrate local imported repository paths to include the repository name
-- Previously, the path and name were concatenated at runtime. Now the path should be the full path.
UPDATE `repositories_table`
SET `config` = json_set(`config`, '$.path', rtrim(json_extract(`config`, '$.path'), '/') || '/' || json_extract(`config`, '$.name')),
`updated_at` = (unixepoch() * 1000)
WHERE `type` = 'local'
AND json_extract(`config`, '$.isExistingRepository') = true
AND json_extract(`config`, '$.path') IS NOT NULL
AND json_extract(`config`, '$.name') IS NOT NULL;