From e17f471bd4f6473a85d12f1c586f99c968498df3 Mon Sep 17 00:00:00 2001 From: Ry Walker <4283+ryw@users.noreply.github.com> Date: Tue, 25 Jul 2023 09:51:45 -0400 Subject: [PATCH] order extensions by name asc (#269) Co-authored-by: Ian Stanton --- .github/workflows/registry.yml | 6 +- registry/sqlx-data.json | 148 ++++++++++++++++-------------- registry/src/routes/extensions.rs | 2 +- 3 files changed, 84 insertions(+), 72 deletions(-) diff --git a/.github/workflows/registry.yml b/.github/workflows/registry.yml index 3d8113b6..9b8ffef4 100644 --- a/.github/workflows/registry.yml +++ b/.github/workflows/registry.yml @@ -49,11 +49,11 @@ jobs: - 5432:5432 steps: - uses: actions/checkout@v3 - - name: Install minimal nightly with clippy and rustfmt + - name: Install minimal stable with clippy and rustfmt uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: nightly + toolchain: stable components: rustfmt, clippy - name: Install system dependencies run: | @@ -65,7 +65,7 @@ jobs: with: prefix-key: "lint" - name: Cargo format - run: cargo +nightly fmt --all --check + run: cargo fmt --all --check - name: Run migrations run: cargo sqlx migrate run - name: Migrations check diff --git a/registry/sqlx-data.json b/registry/sqlx-data.json index ea0b5897..90d363a8 100644 --- a/registry/sqlx-data.json +++ b/registry/sqlx-data.json @@ -424,72 +424,6 @@ }, "query": "\n INSERT INTO versions(extension_id, num, created_at, yanked, license, published_by)\n VALUES ($1, $2, (now() at time zone 'utc'), $3, $4, $5)\n " }, - "48a96a05f91d89cfd30f0cd3b119f0690a53d71d82ad9d40a5b0a07941fc31c9": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "name", - "ordinal": 1, - "type_info": "Varchar" - }, - { - "name": "updated_at", - "ordinal": 2, - "type_info": "Timestamptz" - }, - { - "name": "created_at", - "ordinal": 3, - "type_info": "Timestamptz" - }, - { - "name": "downloads", - "ordinal": 4, - "type_info": "Int4" - }, - { - "name": "description", - "ordinal": 5, - "type_info": "Varchar" - }, - { - "name": "homepage", - "ordinal": 6, - "type_info": "Varchar" - }, - { - "name": "documentation", - "ordinal": 7, - "type_info": "Varchar" - }, - { - "name": "repository", - "ordinal": 8, - "type_info": "Varchar" - } - ], - "nullable": [ - false, - true, - false, - false, - true, - true, - true, - true, - true - ], - "parameters": { - "Left": [] - } - }, - "query": "SELECT * FROM extensions" - }, "49a41631cfe21efe58022e6e4026e6f3d388d8bb12ac478dbf30addab78d430e": { "describe": { "columns": [ @@ -739,6 +673,11 @@ "name": "links", "ordinal": 12, "type_info": "Varchar" + }, + { + "name": "postgres_version", + "ordinal": 13, + "type_info": "Int4" } ], "nullable": [ @@ -754,7 +693,8 @@ true, true, true, - true + true, + false ], "parameters": { "Left": [ @@ -765,6 +705,72 @@ }, "query": "SELECT *\n FROM versions\n WHERE \n extension_id = $1\n and num = $2" }, + "7cc69acf039075253b7224f17a7038e9f25d9974875b2d0d3c75983afc2c77fb": { + "describe": { + "columns": [ + { + "name": "id", + "ordinal": 0, + "type_info": "Int8" + }, + { + "name": "name", + "ordinal": 1, + "type_info": "Varchar" + }, + { + "name": "updated_at", + "ordinal": 2, + "type_info": "Timestamptz" + }, + { + "name": "created_at", + "ordinal": 3, + "type_info": "Timestamptz" + }, + { + "name": "downloads", + "ordinal": 4, + "type_info": "Int4" + }, + { + "name": "description", + "ordinal": 5, + "type_info": "Varchar" + }, + { + "name": "homepage", + "ordinal": 6, + "type_info": "Varchar" + }, + { + "name": "documentation", + "ordinal": 7, + "type_info": "Varchar" + }, + { + "name": "repository", + "ordinal": 8, + "type_info": "Varchar" + } + ], + "nullable": [ + false, + true, + false, + false, + true, + true, + true, + true, + true + ], + "parameters": { + "Left": [] + } + }, + "query": "SELECT * FROM extensions order by name asc" + }, "7d372fca1ed8b3cd12573033e0329361636b95ffb41b9e13be2844755ab37a75": { "describe": { "columns": [ @@ -832,6 +838,11 @@ "name": "links", "ordinal": 12, "type_info": "Varchar" + }, + { + "name": "postgres_version", + "ordinal": 13, + "type_info": "Int4" } ], "nullable": [ @@ -847,7 +858,8 @@ true, true, true, - true + true, + false ], "parameters": { "Left": [ diff --git a/registry/src/routes/extensions.rs b/registry/src/routes/extensions.rs index 8d8af8f7..8f399b2c 100644 --- a/registry/src/routes/extensions.rs +++ b/registry/src/routes/extensions.rs @@ -291,7 +291,7 @@ pub async fn get_all_extensions( // Create a database transaction let mut tx = conn.begin().await?; - let rows = sqlx::query!("SELECT * FROM extensions") + let rows = sqlx::query!("SELECT * FROM extensions order by name asc") .fetch_all(&mut tx) .await?; for row in rows.iter() {