Skip to content
Snippets Groups Projects
Commit d0ed4745 authored by Erwan Rouchet's avatar Erwan Rouchet
Browse files

Merge branch 'export-repository-url' into 'master'

Export repository url

Closes #824

See merge request !1459
parents 9703c7ad 0bc78c74
No related branches found
No related tags found
1 merge request!1459Export repository url
......@@ -16,6 +16,7 @@ CREATE TABLE worker_version (
slug VARCHAR(100) NOT NULL,
type VARCHAR(50) NOT NULL,
revision VARCHAR(50) NOT NULL,
repository_url TEXT NOT NULL,
PRIMARY KEY (id)
);
......
......@@ -3,9 +3,10 @@
-- fills up the RAM. Adding DISTINCT to all the SELECT queries of the UNION
-- slows this query down by ~20%. Using multiple INs instead of a UNION makes
-- this query twice as slow.
SELECT version.id, worker.name, worker.slug, worker.type, revision.hash
SELECT version.id, worker.name, worker.slug, worker.type, revision.hash, repository.url
FROM dataimport_workerversion version
INNER JOIN dataimport_worker worker ON (version.worker_id = worker.id)
INNER JOIN dataimport_repository repository ON (worker.repository_id = repository.id)
INNER JOIN dataimport_revision revision ON (version.revision_id = revision.id)
WHERE version.id IN (
SELECT worker_version_id FROM documents_element WHERE corpus_id = '{corpus_id}'::uuid
......
......@@ -137,21 +137,23 @@ class TestExport(FixtureTestCase):
)
self.assertCountEqual(
db.execute('SELECT id, name, slug, type, revision FROM worker_version').fetchall(),
db.execute('SELECT id, name, slug, type, revision, repository_url FROM worker_version').fetchall(),
[
(
str(version.id),
version.worker.name,
version.worker.slug,
version.worker.type,
version.revision.hash
version.revision.hash,
version.worker.repository.url
),
(
str(metadata_version.id),
metadata_version.worker.name,
metadata_version.worker.slug,
metadata_version.worker.type,
metadata_version.revision.hash
metadata_version.revision.hash,
metadata_version.worker.repository.url
)
]
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment