Skip to content

Commit

Permalink
database: Remove crates.downloads column
Browse files Browse the repository at this point in the history
  • Loading branch information
Turbo87 committed Mar 6, 2024
1 parent 19c54b7 commit ddb6df0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
9 changes: 9 additions & 0 deletions migrations/2024-03-04-144536_remove-downloads-column/down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
alter table crates
add column downloads integer not null default 0;

-- The following query can take a couple of seconds so it should be run manually
-- outside of the migration to prevent the server from taking a long time to
-- start up while waiting for the migration to complete.

-- update crates
-- set downloads = (select downloads from crate_downloads where crate_downloads.crate_id = crates.id);
2 changes: 2 additions & 0 deletions migrations/2024-03-04-144536_remove-downloads-column/up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
alter table crates
drop column downloads;
6 changes: 0 additions & 6 deletions src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,12 +315,6 @@ diesel::table! {
///
/// (Automatically generated by Diesel.)
created_at -> Timestamp,
/// The `downloads` column of the `crates` table.
///
/// Its SQL type is `Int4`.
///
/// (Automatically generated by Diesel.)
downloads -> Int4,
/// The `description` column of the `crates` table.
///
/// Its SQL type is `Nullable<Varchar>`.
Expand Down
1 change: 0 additions & 1 deletion src/worker/jobs/dump_db/dump-db.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ id = "public"
name = "public"
updated_at = "public"
created_at = "public"
downloads = "public"
description = "public"
homepage = "public"
documentation = "public"
Expand Down

0 comments on commit ddb6df0

Please sign in to comment.