Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support 1.62 running doc-tests on private macros #1764

Merged
merged 1 commit into from
Jul 12, 2022
Merged
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
20 changes: 10 additions & 10 deletions src/db/migrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use schemamama_postgres::{PostgresAdapter, PostgresMigration};
///
/// Example:
///
/// ```
/// ```no_compile
/// let my_migration = migration!(100,
/// "migrate data",
/// |transaction: &mut Transaction| -> Result<(), PostgresError> {
Expand Down Expand Up @@ -73,7 +73,7 @@ macro_rules! migration {
///
/// Example:
///
/// ```
/// ```no_compile
/// let my_migration = sql_migration!(100,
/// "Create test table",
/// "CREATE TABLE test ( id SERIAL);",
Expand Down Expand Up @@ -650,7 +650,7 @@ pub fn migrate(version: Option<Version>, conn: &mut Client) -> crate::error::Res
sql_migration!(
context,
26,
"create indexes for crates, github_repos and releases",
"create indexes for crates, github_repos and releases",
// upgrade
"
CREATE INDEX crates_latest_version_idx ON crates (latest_version_id);
Expand Down Expand Up @@ -788,7 +788,7 @@ pub fn migrate(version: Option<Version>, conn: &mut Client) -> crate::error::Res
"ALTER TABLE releases DROP COLUMN archive_storage;",
),
sql_migration!(
context, 31, "add index on builds.build_time",
context, 31, "add index on builds.build_time",
"CREATE INDEX builds_build_time_idx ON builds (build_time DESC);",
"DROP INDEX builds_build_time_idx;",
),
Expand All @@ -800,14 +800,14 @@ pub fn migrate(version: Option<Version>, conn: &mut Client) -> crate::error::Res
use crate::web::crate_details::CrateDetails;
let rows = transaction.query(
"SELECT crates.name, max(releases.version) as max_version_id
FROM crates
INNER JOIN releases ON crates.id = releases.crate_id
FROM crates
INNER JOIN releases ON crates.id = releases.crate_id
GROUP BY crates.name",
&[],
)?;

let update_version_query = transaction.prepare(
"UPDATE crates
"UPDATE crates
SET latest_version_id = $2
WHERE id = $1",
)?;
Expand All @@ -827,10 +827,10 @@ pub fn migrate(version: Option<Version>, conn: &mut Client) -> crate::error::Res
|transaction: &mut Transaction| -> Result<(), PostgresError> {
transaction
.execute(
"UPDATE crates
"UPDATE crates
SET latest_version_id = (
SELECT max(id)
FROM releases
SELECT max(id)
FROM releases
WHERE releases.crate_id = crates.id
)",
&[],
Expand Down