summaryrefslogtreecommitdiffstats
path: root/src/db
diff options
context:
space:
mode:
Diffstat (limited to 'src/db')
-rw-r--r--src/db/find_artifacts.rs11
-rw-r--r--src/db/models/artifact.rs4
-rw-r--r--src/db/models/releases.rs1
3 files changed, 11 insertions, 5 deletions
diff --git a/src/db/find_artifacts.rs b/src/db/find_artifacts.rs
index e3e418d..b4fbe3b 100644
--- a/src/db/find_artifacts.rs
+++ b/src/db/find_artifacts.rs
@@ -54,7 +54,7 @@ pub fn find_artifacts<'a>(
database_connection: Arc<PgConnection>,
config: &Configuration,
pkg: &Package,
- release_store: &'a ReleaseStore,
+ release_stores: &'a [Arc<ReleaseStore>],
staging_store: Option<&'a StagingStore>,
additional_env: &[(EnvironmentVariableName, String)],
script_filter: bool,
@@ -220,11 +220,14 @@ pub fn find_artifacts<'a>(
// If we cannot find the artifact in the release store either, we return None.
// This is the case if there indeed was a release, but it was removed from the
// filesystem.
- if let Some(art) = release_store.get(&artpath) {
- trace!("Found in release: {:?}", art);
- return release_store.root_path().join(art).map(|p| p.map(|p| (p, ndt)))
+ for release_store in release_stores {
+ if let Some(art) = release_store.get(&artpath) {
+ trace!("Found in release: {:?}", art);
+ return release_store.root_path().join(art).map(|p| p.map(|p| (p, ndt)))
+ }
}
+ trace!("Found no release for artifact {:?} in any release store", artpath.display());
Ok(None)
})
.filter_map_ok(|opt| opt)
diff --git a/src/db/models/artifact.rs b/src/db/models/artifact.rs
index 11e2cec..e5adbaf 100644
--- a/src/db/models/artifact.rs
+++ b/src/db/models/artifact.rs
@@ -48,8 +48,10 @@ impl Artifact {
self,
database_connection: &PgConnection,
release_date: &NaiveDateTime,
+ release_store_name: &str,
) -> Result<crate::db::models::Release> {
- crate::db::models::Release::create(database_connection, &self, release_date)
+ let rs = crate::db::models::ReleaseStore::create(database_connection, release_store_name)?;
+ crate::db::models::Release::create(database_connection, &self, release_date, &rs)
}
pub fn get_release(&self, database_connection: &PgConnection) -> Result<Option<Release>> {
diff --git a/src/db/models/releases.rs b/src/db/models/releases.rs
index 9136fee..48e4f02 100644
--- a/src/db/models/releases.rs
+++ b/src/db/models/releases.rs
@@ -47,6 +47,7 @@ impl Release {
let new_rel = NewRelease {
artifact_id: art.id,
release_date: date,
+ release_store_id: store.id,
};
diesel::insert_into(releases::table)