diff --git a/.sqlx/query-042004a9e2339b1bd089b753c817d60445a38d6f10477a974d18775ec04f2fd5.json b/.sqlx/query-042004a9e2339b1bd089b753c817d60445a38d6f10477a974d18775ec04f2fd5.json new file mode 100644 index 0000000..c4bde7a --- /dev/null +++ b/.sqlx/query-042004a9e2339b1bd089b753c817d60445a38d6f10477a974d18775ec04f2fd5.json @@ -0,0 +1,15 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE mods SET image = $1, updated_at = now() WHERE id = $2", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Bytea", + "Text" + ] + }, + "nullable": [] + }, + "hash": "042004a9e2339b1bd089b753c817d60445a38d6f10477a974d18775ec04f2fd5" +} diff --git a/.sqlx/query-14cd22475a4bd7b386ff6dd4cd9b5b06ee30907186a19db1b48bc904de6b769c.json b/.sqlx/query-14cd22475a4bd7b386ff6dd4cd9b5b06ee30907186a19db1b48bc904de6b769c.json new file mode 100644 index 0000000..dafdb71 --- /dev/null +++ b/.sqlx/query-14cd22475a4bd7b386ff6dd4cd9b5b06ee30907186a19db1b48bc904de6b769c.json @@ -0,0 +1,35 @@ +{ + "db_name": "PostgreSQL", + "query": "\n SELECT * FROM mod_downloads\n WHERE ip = $1 AND mod_version_id = $2\n ", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "mod_version_id", + "type_info": "Int4" + }, + { + "ordinal": 1, + "name": "ip", + "type_info": "Inet" + }, + { + "ordinal": 2, + "name": "time_downloaded", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Inet", + "Int4" + ] + }, + "nullable": [ + false, + false, + false + ] + }, + "hash": "14cd22475a4bd7b386ff6dd4cd9b5b06ee30907186a19db1b48bc904de6b769c" +} diff --git a/.sqlx/query-2d380fa8673e6d5ebb41d9df8ef7dace9b64232a7ee22bde6eada58b675dbc81.json b/.sqlx/query-2d380fa8673e6d5ebb41d9df8ef7dace9b64232a7ee22bde6eada58b675dbc81.json new file mode 100644 index 0000000..86f7940 --- /dev/null +++ b/.sqlx/query-2d380fa8673e6d5ebb41d9df8ef7dace9b64232a7ee22bde6eada58b675dbc81.json @@ -0,0 +1,12 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE mod_versions mv SET download_count = mv.download_count + (\n SELECT COUNT(DISTINCT md.ip) FROM mod_downloads md\n WHERE md.mod_version_id = mv.id AND md.time_downloaded > mv.last_download_cache_refresh \n ), last_download_cache_refresh = now()\n WHERE mv.validated = true", + "describe": { + "columns": [], + "parameters": { + "Left": [] + }, + "nullable": [] + }, + "hash": "2d380fa8673e6d5ebb41d9df8ef7dace9b64232a7ee22bde6eada58b675dbc81" +} diff --git a/.sqlx/query-69d80a0dffc4d0f6ab597f36b8b0f822df4fca908626584a676aaa627255e01b.json b/.sqlx/query-69d80a0dffc4d0f6ab597f36b8b0f822df4fca908626584a676aaa627255e01b.json new file mode 100644 index 0000000..9d42d34 --- /dev/null +++ b/.sqlx/query-69d80a0dffc4d0f6ab597f36b8b0f822df4fca908626584a676aaa627255e01b.json @@ -0,0 +1,22 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT DISTINCT m.image FROM mods m\n INNER JOIN mod_versions mv ON mv.mod_id = m.id WHERE m.id = $1 AND mv.validated = true", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "image", + "type_info": "Bytea" + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + true + ] + }, + "hash": "69d80a0dffc4d0f6ab597f36b8b0f822df4fca908626584a676aaa627255e01b" +} diff --git a/.sqlx/query-6c237ee29dee664dabe8175e9d81add4ca9ea87043d8444d6db938a83f400f54.json b/.sqlx/query-6c237ee29dee664dabe8175e9d81add4ca9ea87043d8444d6db938a83f400f54.json new file mode 100644 index 0000000..73e1b99 --- /dev/null +++ b/.sqlx/query-6c237ee29dee664dabe8175e9d81add4ca9ea87043d8444d6db938a83f400f54.json @@ -0,0 +1,28 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT DISTINCT id, name FROM mod_tags WHERE name = ANY($1)", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Int4" + }, + { + "ordinal": 1, + "name": "name", + "type_info": "Text" + } + ], + "parameters": { + "Left": [ + "TextArray" + ] + }, + "nullable": [ + false, + false + ] + }, + "hash": "6c237ee29dee664dabe8175e9d81add4ca9ea87043d8444d6db938a83f400f54" +} diff --git a/.sqlx/query-6dd6bf8ee4c81720f7682a478e2118406e4a53555331609283a518ab984144ee.json b/.sqlx/query-6dd6bf8ee4c81720f7682a478e2118406e4a53555331609283a518ab984144ee.json new file mode 100644 index 0000000..60d8146 --- /dev/null +++ b/.sqlx/query-6dd6bf8ee4c81720f7682a478e2118406e4a53555331609283a518ab984144ee.json @@ -0,0 +1,14 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE mods m SET download_count = m.download_count + (\n SELECT COUNT(DISTINCT md.ip) FROM mod_downloads md\n INNER JOIN mod_versions mv ON md.mod_version_id = mv.id\n WHERE mv.mod_id = m.id AND md.time_downloaded > m.last_download_cache_refresh AND mv.validated = true\n ), last_download_cache_refresh = now()\n WHERE m.id = $1", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [] + }, + "hash": "6dd6bf8ee4c81720f7682a478e2118406e4a53555331609283a518ab984144ee" +} diff --git a/.sqlx/query-7f6e413b18f3641e2977a78b083123de9d2d964d39fbaafe25fe2caf933a85b5.json b/.sqlx/query-7f6e413b18f3641e2977a78b083123de9d2d964d39fbaafe25fe2caf933a85b5.json new file mode 100644 index 0000000..7f45081 --- /dev/null +++ b/.sqlx/query-7f6e413b18f3641e2977a78b083123de9d2d964d39fbaafe25fe2caf933a85b5.json @@ -0,0 +1,12 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE mods m SET download_count = m.download_count + (\n SELECT COUNT(DISTINCT md.ip) FROM mod_downloads md\n INNER JOIN mod_versions mv ON md.mod_version_id = mv.id\n WHERE mv.mod_id = m.id AND md.time_downloaded > m.last_download_cache_refresh AND mv.validated = true\n ), last_download_cache_refresh = now()\n WHERE m.id IN (SELECT DISTINCT mv.mod_id FROM mod_versions mv WHERE mv.validated = true)", + "describe": { + "columns": [], + "parameters": { + "Left": [] + }, + "nullable": [] + }, + "hash": "7f6e413b18f3641e2977a78b083123de9d2d964d39fbaafe25fe2caf933a85b5" +} diff --git a/.sqlx/query-503bcbb637879d3f142d7826a03e395dde64bb4f5799386eb8219ad3bdfdbf93.json b/.sqlx/query-840784044c518387656bde979e981c87d88e7a9367bbfdd7cb391632acb886f6.json similarity index 74% rename from .sqlx/query-503bcbb637879d3f142d7826a03e395dde64bb4f5799386eb8219ad3bdfdbf93.json rename to .sqlx/query-840784044c518387656bde979e981c87d88e7a9367bbfdd7cb391632acb886f6.json index d1eda07..80498c5 100644 --- a/.sqlx/query-503bcbb637879d3f142d7826a03e395dde64bb4f5799386eb8219ad3bdfdbf93.json +++ b/.sqlx/query-840784044c518387656bde979e981c87d88e7a9367bbfdd7cb391632acb886f6.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "SELECT\n mv.id, mv.name, mv.description, mv.version, mv.download_link,\n mv.hash, mv.geode, mv.early_load, mv.api, mv.mod_id FROM mod_versions mv\n INNER JOIN mods m ON m.id = mv.mod_id\n WHERE mv.mod_id = $1 AND mv.version = $2 AND mv.validated = true", + "query": "SELECT\n mv.id, mv.name, mv.description, mv.version, mv.download_link, mv.download_count,\n mv.hash, mv.geode, mv.early_load, mv.api, mv.mod_id FROM mod_versions mv\n INNER JOIN mods m ON m.id = mv.mod_id\n WHERE mv.mod_id = $1 AND mv.version = $2 AND mv.validated = true", "describe": { "columns": [ { @@ -30,26 +30,31 @@ }, { "ordinal": 5, + "name": "download_count", + "type_info": "Int4" + }, + { + "ordinal": 6, "name": "hash", "type_info": "Text" }, { - "ordinal": 6, + "ordinal": 7, "name": "geode", "type_info": "Text" }, { - "ordinal": 7, + "ordinal": 8, "name": "early_load", "type_info": "Bool" }, { - "ordinal": 8, + "ordinal": 9, "name": "api", "type_info": "Bool" }, { - "ordinal": 9, + "ordinal": 10, "name": "mod_id", "type_info": "Text" } @@ -70,8 +75,9 @@ false, false, false, + false, false ] }, - "hash": "503bcbb637879d3f142d7826a03e395dde64bb4f5799386eb8219ad3bdfdbf93" + "hash": "840784044c518387656bde979e981c87d88e7a9367bbfdd7cb391632acb886f6" } diff --git a/.sqlx/query-b7e31d7c81fa04928e659cf5acfb71719da68329f5b1f568774359cae28e997e.json b/.sqlx/query-91276495f6b9ac291ca4e1b022145df2c2732cf4debf17205823b800c5a9bbb8.json similarity index 71% rename from .sqlx/query-b7e31d7c81fa04928e659cf5acfb71719da68329f5b1f568774359cae28e997e.json rename to .sqlx/query-91276495f6b9ac291ca4e1b022145df2c2732cf4debf17205823b800c5a9bbb8.json index a141ce3..cfa46ee 100644 --- a/.sqlx/query-b7e31d7c81fa04928e659cf5acfb71719da68329f5b1f568774359cae28e997e.json +++ b/.sqlx/query-91276495f6b9ac291ca4e1b022145df2c2732cf4debf17205823b800c5a9bbb8.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "SELECT\n m.id, m.repository, m.latest_version, mv.validated, m.about, m.changelog,\n mv.id as version_id, mv.name, mv.description, mv.version, mv.download_link,\n mv.hash, mv.geode, mv.early_load, mv.api, mv.mod_id\n FROM mods m\n INNER JOIN mod_versions mv ON m.id = mv.mod_id\n WHERE m.id = $1 AND mv.validated = true", + "query": "SELECT\n m.id, m.repository, m.latest_version, mv.validated, m.about, m.changelog, m.download_count as mod_download_count,\n mv.id as version_id, mv.name, mv.description, mv.version, mv.download_link, mv.download_count as mod_version_download_count,\n mv.hash, mv.geode, mv.early_load, mv.api, mv.mod_id\n FROM mods m\n INNER JOIN mod_versions mv ON m.id = mv.mod_id\n WHERE m.id = $1 AND mv.validated = true", "describe": { "columns": [ { @@ -35,51 +35,61 @@ }, { "ordinal": 6, - "name": "version_id", + "name": "mod_download_count", "type_info": "Int4" }, { "ordinal": 7, + "name": "version_id", + "type_info": "Int4" + }, + { + "ordinal": 8, "name": "name", "type_info": "Text" }, { - "ordinal": 8, + "ordinal": 9, "name": "description", "type_info": "Text" }, { - "ordinal": 9, + "ordinal": 10, "name": "version", "type_info": "Text" }, { - "ordinal": 10, + "ordinal": 11, "name": "download_link", "type_info": "Text" }, { - "ordinal": 11, + "ordinal": 12, + "name": "mod_version_download_count", + "type_info": "Int4" + }, + { + "ordinal": 13, "name": "hash", "type_info": "Text" }, { - "ordinal": 12, + "ordinal": 14, "name": "geode", "type_info": "Text" }, { - "ordinal": 13, + "ordinal": 15, "name": "early_load", "type_info": "Bool" }, { - "ordinal": 14, + "ordinal": 16, "name": "api", "type_info": "Bool" }, { - "ordinal": 15, + "ordinal": 17, "name": "mod_id", "type_info": "Text" } @@ -98,6 +108,7 @@ true, false, false, + false, true, false, false, @@ -105,8 +116,9 @@ false, false, false, + false, false ] }, - "hash": "b7e31d7c81fa04928e659cf5acfb71719da68329f5b1f568774359cae28e997e" + "hash": "91276495f6b9ac291ca4e1b022145df2c2732cf4debf17205823b800c5a9bbb8" } diff --git a/.sqlx/query-dcd87f6f6e96c21cb535315ae20765f0418b792b0788b1b9fd389439dcf027a5.json b/.sqlx/query-dcd87f6f6e96c21cb535315ae20765f0418b792b0788b1b9fd389439dcf027a5.json new file mode 100644 index 0000000..401e42a --- /dev/null +++ b/.sqlx/query-dcd87f6f6e96c21cb535315ae20765f0418b792b0788b1b9fd389439dcf027a5.json @@ -0,0 +1,15 @@ +{ + "db_name": "PostgreSQL", + "query": "\n INSERT INTO mod_downloads (ip, mod_version_id)\n VALUES ($1, $2)\n ", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Inet", + "Int4" + ] + }, + "nullable": [] + }, + "hash": "dcd87f6f6e96c21cb535315ae20765f0418b792b0788b1b9fd389439dcf027a5" +} diff --git a/.sqlx/query-ea929bec66f3e884938394bbb6a4c06e4b5e0327076d1acd45e1d0c9ffc0a3c1.json b/.sqlx/query-ea929bec66f3e884938394bbb6a4c06e4b5e0327076d1acd45e1d0c9ffc0a3c1.json new file mode 100644 index 0000000..c2cf5e0 --- /dev/null +++ b/.sqlx/query-ea929bec66f3e884938394bbb6a4c06e4b5e0327076d1acd45e1d0c9ffc0a3c1.json @@ -0,0 +1,14 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE mod_versions mv SET download_count = mv.download_count + (\n SELECT COUNT(DISTINCT md.ip) FROM mod_downloads md\n WHERE md.mod_version_id = mv.id AND md.time_downloaded > mv.last_download_cache_refresh \n ), last_download_cache_refresh = now()\n WHERE mv.id = $1 AND mv.validated = true", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int4" + ] + }, + "nullable": [] + }, + "hash": "ea929bec66f3e884938394bbb6a4c06e4b5e0327076d1acd45e1d0c9ffc0a3c1" +} diff --git a/.sqlx/query-20a03a1692dfc0938af04b430db7a2a34f6c595692fd9109d208890b66a903b5.json b/.sqlx/query-ec91c52f4663d3c27510c440be107aed1d6a8bf7e3a54872263fa36e7f1dcd6f.json similarity index 55% rename from .sqlx/query-20a03a1692dfc0938af04b430db7a2a34f6c595692fd9109d208890b66a903b5.json rename to .sqlx/query-ec91c52f4663d3c27510c440be107aed1d6a8bf7e3a54872263fa36e7f1dcd6f.json index 8434812..43ac8ca 100644 --- a/.sqlx/query-20a03a1692dfc0938af04b430db7a2a34f6c595692fd9109d208890b66a903b5.json +++ b/.sqlx/query-ec91c52f4663d3c27510c440be107aed1d6a8bf7e3a54872263fa36e7f1dcd6f.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "SELECT id, username, display_name\n FROM developers WHERE github_user_id = $1", + "query": "SELECT dev.id, dev.username, dev.display_name, md.is_owner FROM developers dev\n INNER JOIN mods_developers md ON md.developer_id = dev.id WHERE md.mod_id = $1", "describe": { "columns": [ { @@ -17,18 +17,24 @@ "ordinal": 2, "name": "display_name", "type_info": "Text" + }, + { + "ordinal": 3, + "name": "is_owner", + "type_info": "Bool" } ], "parameters": { "Left": [ - "Int8" + "Text" ] }, "nullable": [ + false, false, false, false ] }, - "hash": "20a03a1692dfc0938af04b430db7a2a34f6c595692fd9109d208890b66a903b5" + "hash": "ec91c52f4663d3c27510c440be107aed1d6a8bf7e3a54872263fa36e7f1dcd6f" } diff --git a/.sqlx/query-61f630cc2364cb1d71b6f5b58e221d2c1b936d83287ac328dcb20624c2cc03dd.json b/.sqlx/query-f59b683ceb27752b572d694c67760ddcaea1b747eb5fca61776521dc6e6b0600.json similarity index 62% rename from .sqlx/query-61f630cc2364cb1d71b6f5b58e221d2c1b936d83287ac328dcb20624c2cc03dd.json rename to .sqlx/query-f59b683ceb27752b572d694c67760ddcaea1b747eb5fca61776521dc6e6b0600.json index 5132ff7..308992f 100644 --- a/.sqlx/query-61f630cc2364cb1d71b6f5b58e221d2c1b936d83287ac328dcb20624c2cc03dd.json +++ b/.sqlx/query-f59b683ceb27752b572d694c67760ddcaea1b747eb5fca61776521dc6e6b0600.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "SELECT dev.id, dev.username, dev.display_name, dev.verified, dev.admin, md.is_owner FROM developers dev\n INNER JOIN mods_developers md ON md.developer_id = dev.id WHERE md.mod_id = $1", + "query": "SELECT id, username, display_name, verified, admin\n FROM developers WHERE github_user_id = $1", "describe": { "columns": [ { @@ -27,16 +27,11 @@ "ordinal": 4, "name": "admin", "type_info": "Bool" - }, - { - "ordinal": 5, - "name": "is_owner", - "type_info": "Bool" } ], "parameters": { "Left": [ - "Text" + "Int8" ] }, "nullable": [ @@ -44,9 +39,8 @@ false, false, false, - false, false ] }, - "hash": "61f630cc2364cb1d71b6f5b58e221d2c1b936d83287ac328dcb20624c2cc03dd" + "hash": "f59b683ceb27752b572d694c67760ddcaea1b747eb5fca61776521dc6e6b0600" }