Skip to content

Commit a4477bb

Browse files
committed
cleanup
1 parent de931f9 commit a4477bb

File tree

4 files changed

+11
-78
lines changed

4 files changed

+11
-78
lines changed

src/metadata.sql

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ CREATE TABLE package_maintainers (
1919

2020
CREATE TABLE packages (
2121
id INTEGER PRIMARY KEY AUTOINCREMENT,
22-
disabled BOOLEAN NOT NULL DEFAULT false,
23-
disabled_reason JSONB,
2422
rank INT,
2523
pkg TEXT COLLATE NOCASE,
2624
pkg_id TEXT NOT NULL COLLATE NOCASE,

src/models.rs

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,9 @@ impl PackageProvide {
4848

4949
#[derive(Debug, Default, Clone, Deserialize, Serialize)]
5050
pub struct RemotePackage {
51-
#[serde(deserialize_with = "flexible_bool", alias = "_disabled")]
52-
pub disabled: Option<bool>,
53-
54-
#[serde(alias = "_disabled_reason")]
55-
pub disabled_reason: Option<serde_json::Value>,
56-
5751
#[serde(default, deserialize_with = "optional_u64")]
5852
pub rank: Option<u64>,
5953

60-
#[serde(default, deserialize_with = "empty_is_none")]
61-
pub pkg: Option<String>,
62-
6354
pub pkg_id: String,
6455
pub pkg_name: String,
6556

@@ -75,9 +66,6 @@ pub struct RemotePackage {
7566
pub description: String,
7667
pub version: String,
7768

78-
#[serde(default, deserialize_with = "empty_is_none")]
79-
pub version_upstream: Option<String>,
80-
8169
pub download_url: String,
8270

8371
#[serde(default, deserialize_with = "optional_u64")]
@@ -118,9 +106,6 @@ pub struct RemotePackage {
118106
#[serde(default, deserialize_with = "empty_is_none")]
119107
pub bsum: Option<String>,
120108

121-
#[serde(default, deserialize_with = "empty_is_none")]
122-
pub shasum: Option<String>,
123-
124109
#[serde(default, deserialize_with = "empty_is_none")]
125110
pub build_id: Option<String>,
126111

@@ -153,21 +138,6 @@ pub struct RemotePackage {
153138
#[serde(default, deserialize_with = "empty_is_none")]
154139
pub app_id: Option<String>,
155140

156-
#[serde(default, deserialize_with = "optional_u64")]
157-
pub download_count: Option<u64>,
158-
159-
#[serde(default, deserialize_with = "optional_u64")]
160-
pub download_count_month: Option<u64>,
161-
162-
#[serde(default, deserialize_with = "optional_u64")]
163-
pub download_count_week: Option<u64>,
164-
165-
#[serde(default, deserialize_with = "flexible_bool")]
166-
pub bundle: Option<bool>,
167-
168-
#[serde(default, deserialize_with = "empty_is_none")]
169-
pub bundle_type: Option<String>,
170-
171141
#[serde(default, deserialize_with = "flexible_bool")]
172142
pub soar_syms: Option<bool>,
173143

@@ -177,27 +147,12 @@ pub struct RemotePackage {
177147
#[serde(default, deserialize_with = "flexible_bool")]
178148
pub desktop_integration: Option<bool>,
179149

180-
#[serde(default, deserialize_with = "flexible_bool")]
181-
pub external: Option<bool>,
182-
183-
#[serde(default, deserialize_with = "flexible_bool")]
184-
pub installable: Option<bool>,
185-
186150
#[serde(default, deserialize_with = "flexible_bool")]
187151
pub portable: Option<bool>,
188152

189153
#[serde(default, deserialize_with = "flexible_bool")]
190154
pub recurse_provides: Option<bool>,
191155

192-
#[serde(default, deserialize_with = "flexible_bool")]
193-
pub trusted: Option<bool>,
194-
195-
#[serde(default, deserialize_with = "empty_is_none")]
196-
pub version_latest: Option<String>,
197-
198-
#[serde(default, deserialize_with = "flexible_bool")]
199-
pub version_outdated: Option<bool>,
200-
201156
pub repology: Option<Vec<String>>,
202157
pub snapshots: Option<Vec<String>>,
203158
pub replaces: Option<Vec<String>>,

src/repository.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ impl<'a> PackageRepository<'a> {
6565
}
6666

6767
fn insert_package(&mut self, package: &RemotePackage) -> Result<()> {
68-
let disabled_reason = serde_json::to_string(&package.disabled_reason).unwrap();
6968
let licenses = serde_json::to_string(&package.licenses).unwrap();
7069
let ghcr_files = serde_json::to_string(&package.ghcr_files).unwrap();
7170
let homepages = serde_json::to_string(&package.homepages).unwrap();
@@ -94,10 +93,7 @@ impl<'a> PackageRepository<'a> {
9493
});
9594
let provides = serde_json::to_string(&provides).unwrap();
9695
let inserted = self.statements.package_insert.execute(params![
97-
package.disabled,
98-
disabled_reason,
9996
package.rank,
100-
package.pkg,
10197
package.pkg_id,
10298
package.pkg_name,
10399
package.pkg_family,
@@ -106,7 +102,6 @@ impl<'a> PackageRepository<'a> {
106102
package.app_id,
107103
package.description,
108104
package.version,
109-
package.version_upstream,
110105
licenses,
111106
package.download_url,
112107
package.size_raw,
@@ -116,7 +111,6 @@ impl<'a> PackageRepository<'a> {
116111
package.ghcr_blob,
117112
package.ghcr_url,
118113
package.bsum,
119-
package.shasum,
120114
package.icon,
121115
package.desktop,
122116
package.appstream,
@@ -134,21 +128,11 @@ impl<'a> PackageRepository<'a> {
134128
snapshots,
135129
repology,
136130
replaces,
137-
package.download_count,
138-
package.download_count_week,
139-
package.download_count_month,
140-
package.bundle.unwrap_or(false),
141-
package.bundle_type,
142131
package.soar_syms.unwrap_or(false),
143132
package.deprecated.unwrap_or(false),
144133
package.desktop_integration,
145-
package.external,
146-
package.installable,
147134
package.portable,
148135
package.recurse_provides,
149-
package.trusted,
150-
package.version_latest,
151-
package.version_outdated
152136
])?;
153137
if inserted == 0 {
154138
return Ok(());

src/statements.rs

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,23 @@ impl<'a> Statements<'a> {
2525
)?,
2626
package_insert: tx.prepare(
2727
"INSERT INTO packages (
28-
disabled, disabled_reason, rank, pkg, pkg_id, pkg_name,
29-
pkg_family, pkg_type, pkg_webpage, app_id, description,
30-
version, version_upstream, licenses, download_url,
28+
rank, pkg_id, pkg_name, pkg_family, pkg_type, pkg_webpage,
29+
app_id, description, version, licenses, download_url,
3130
size, ghcr_pkg, ghcr_size, ghcr_files, ghcr_blob, ghcr_url,
32-
bsum, shasum, icon, desktop, appstream, homepages, notes,
31+
bsum, icon, desktop, appstream, homepages, notes,
3332
source_urls, tags, categories, build_id, build_date,
3433
build_action, build_script, build_log, provides, snapshots,
35-
repology, replaces, download_count, download_count_week,
36-
download_count_month, bundle, bundle_type, soar_syms,
37-
deprecated, desktop_integration, external, installable,
38-
portable, recurse_provides, trusted, version_latest,
39-
version_outdated
34+
repology, replaces, soar_syms, deprecated,
35+
desktop_integration, portable, recurse_provides
4036
)
4137
VALUES
4238
(
43-
?1, jsonb(?2), ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12,
44-
?13, jsonb(?14), ?15, ?16, ?17, ?18, jsonb(?19), ?20, ?21,
45-
?22, ?23, ?24, ?25, ?26, jsonb(?27), jsonb(?28), jsonb(?29),
46-
jsonb(?30), jsonb(?31), ?32, ?33, ?34, ?35, ?36, jsonb(?37),
47-
jsonb(?38), jsonb(?39), jsonb(?40), ?41, ?42, ?43, ?44,
48-
?45, ?46, ?47, ?48, ?49, ?50, ?51, ?52, ?53, ?54, ?55
39+
?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, jsonb(?10),
40+
?11, ?12, ?13, ?14, jsonb(?15), ?16, ?17, ?18,
41+
?19, ?20, ?21, jsonb(?22), jsonb(?23), jsonb(?24),
42+
jsonb(?25), jsonb(?26), ?27, ?28, ?29, ?30, ?31, jsonb(?32),
43+
jsonb(?33), jsonb(?34), jsonb(?35), ?36, ?37, ?38, ?39,
44+
?40
4945
)
5046
ON CONFLICT (pkg_id, pkg_name, version) DO NOTHING",
5147
)?,

0 commit comments

Comments
 (0)