Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
web: ./target/release/migrate && bin/diesel migration run && bin/start-nginx ./target/release/server
worker: ./target/release/update-downloads daemon 300
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ALTER TABLE version_downloads DROP CONSTRAINT version_downloads_pkey;
ALTER TABLE version_downloads ADD COLUMN id SERIAL PRIMARY KEY;
ALTER TABLE version_downloads ADD COLUMN counted INTEGER NOT NULL DEFAULT 0;
ALTER TABLE version_downloads ADD COLUMN processed BOOLEAN NOT NULL DEFAULT 'f';
UPDATE version_downloads SET counted = downloads, processed = 't';
CREATE UNIQUE INDEX version_downloads_unique ON version_downloads (version_id, date);
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ALTER TABLE version_downloads DROP COLUMN id;
ALTER TABLE version_downloads DROP COLUMN counted;
ALTER TABLE version_downloads DROP COLUMN processed;
DROP INDEX version_downloads_unique;
ALTER TABLE version_downloads ADD PRIMARY KEY (version_id, date);
304 changes: 0 additions & 304 deletions src/bin/update-downloads.rs

This file was deleted.

6 changes: 0 additions & 6 deletions src/download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,13 @@ use pg::rows::Row;
use Model;

pub struct VersionDownload {
pub id: i32,
pub version_id: i32,
pub downloads: i32,
pub counted: i32,
pub date: NaiveDate,
}

#[derive(RustcEncodable, RustcDecodable)]
pub struct EncodableVersionDownload {
pub id: i32,
pub version: i32,
pub downloads: i32,
pub date: String,
Expand All @@ -22,7 +19,6 @@ pub struct EncodableVersionDownload {
impl VersionDownload {
pub fn encodable(self) -> EncodableVersionDownload {
EncodableVersionDownload {
id: self.id,
version: self.version_id,
downloads: self.downloads,
date: self.date.to_string(),
Expand All @@ -33,10 +29,8 @@ impl VersionDownload {
impl Model for VersionDownload {
fn from_row(row: &Row) -> VersionDownload {
VersionDownload {
id: row.get("id"),
version_id: row.get("version_id"),
downloads: row.get("downloads"),
counted: row.get("counted"),
date: row.get("date"),
}
}
Expand Down
Loading