Skip to content

Commit

Permalink
fix lifetime issue in async trait with ugly workaround (for now)
Browse files Browse the repository at this point in the history
Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>
  • Loading branch information
simonsan committed Mar 30, 2024
1 parent df635c7 commit e73d00f
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub struct Migration;

#[async_trait::async_trait]
impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
async fn up(&self, manager: &'life1 SchemaManager<'_>) -> Result<(), DbErr> {
manager

Check warning on line 14 in crates/storage/src/migration/m20240325_000001_create_activities.rs

View check run for this annotation

Codecov / codecov/patch

crates/storage/src/migration/m20240325_000001_create_activities.rs#L13-L14

Added lines #L13 - L14 were not covered by tests
.create_table(
Table::create()
Expand Down Expand Up @@ -70,7 +70,7 @@ impl MigrationTrait for Migration {
.await

Check warning on line 70 in crates/storage/src/migration/m20240325_000001_create_activities.rs

View check run for this annotation

Codecov / codecov/patch

crates/storage/src/migration/m20240325_000001_create_activities.rs#L70

Added line #L70 was not covered by tests
}

async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
async fn down(&self, manager: &'life1 SchemaManager<'_>) -> Result<(), DbErr> {
manager

Check warning on line 74 in crates/storage/src/migration/m20240325_000001_create_activities.rs

View check run for this annotation

Codecov / codecov/patch

crates/storage/src/migration/m20240325_000001_create_activities.rs#L73-L74

Added lines #L73 - L74 were not covered by tests
.drop_table(
Table::drop()
Expand Down
4 changes: 2 additions & 2 deletions crates/storage/src/migration/m20240326_000001_create_tags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub struct Migration;

#[async_trait::async_trait]
impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
async fn up(&self, manager: &'life1 SchemaManager<'_>) -> Result<(), DbErr> {
manager

Check warning on line 11 in crates/storage/src/migration/m20240326_000001_create_tags.rs

View check run for this annotation

Codecov / codecov/patch

crates/storage/src/migration/m20240326_000001_create_tags.rs#L10-L11

Added lines #L10 - L11 were not covered by tests
.create_table(
Table::create()
Expand All @@ -25,7 +25,7 @@ impl MigrationTrait for Migration {
.await

Check warning on line 25 in crates/storage/src/migration/m20240326_000001_create_tags.rs

View check run for this annotation

Codecov / codecov/patch

crates/storage/src/migration/m20240326_000001_create_tags.rs#L25

Added line #L25 was not covered by tests
}

async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
async fn down(&self, manager: &'life1 SchemaManager<'_>) -> Result<(), DbErr> {
manager
.drop_table(Table::drop().table(TagsEnum::Table).if_exists().to_owned())
.await

Check warning on line 31 in crates/storage/src/migration/m20240326_000001_create_tags.rs

View check run for this annotation

Codecov / codecov/patch

crates/storage/src/migration/m20240326_000001_create_tags.rs#L28-L31

Added lines #L28 - L31 were not covered by tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub struct Migration;

#[async_trait::async_trait]
impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
async fn up(&self, manager: &'life1 SchemaManager<'_>) -> Result<(), DbErr> {
manager

Check warning on line 11 in crates/storage/src/migration/m20240326_000002_create_categories.rs

View check run for this annotation

Codecov / codecov/patch

crates/storage/src/migration/m20240326_000002_create_categories.rs#L10-L11

Added lines #L10 - L11 were not covered by tests
.create_table(
Table::create()
Expand All @@ -26,7 +26,7 @@ impl MigrationTrait for Migration {
.await

Check warning on line 26 in crates/storage/src/migration/m20240326_000002_create_categories.rs

View check run for this annotation

Codecov / codecov/patch

crates/storage/src/migration/m20240326_000002_create_categories.rs#L26

Added line #L26 was not covered by tests
}

async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
async fn down(&self, manager: &'life1 SchemaManager<'_>) -> Result<(), DbErr> {
manager

Check warning on line 30 in crates/storage/src/migration/m20240326_000002_create_categories.rs

View check run for this annotation

Codecov / codecov/patch

crates/storage/src/migration/m20240326_000002_create_categories.rs#L29-L30

Added lines #L29 - L30 were not covered by tests
.drop_table(
Table::drop()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub struct Migration;

#[async_trait::async_trait]
impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
async fn up(&self, manager: &'life1 SchemaManager<'_>) -> Result<(), DbErr> {
manager

Check warning on line 11 in crates/storage/src/migration/m20240326_000003_create_activity_status.rs

View check run for this annotation

Codecov / codecov/patch

crates/storage/src/migration/m20240326_000003_create_activity_status.rs#L10-L11

Added lines #L10 - L11 were not covered by tests
.create_table(
Table::create()
Expand All @@ -25,7 +25,7 @@ impl MigrationTrait for Migration {
.await

Check warning on line 25 in crates/storage/src/migration/m20240326_000003_create_activity_status.rs

View check run for this annotation

Codecov / codecov/patch

crates/storage/src/migration/m20240326_000003_create_activity_status.rs#L25

Added line #L25 was not covered by tests
}

async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
async fn down(&self, manager: &'life1 SchemaManager<'_>) -> Result<(), DbErr> {
manager

Check warning on line 29 in crates/storage/src/migration/m20240326_000003_create_activity_status.rs

View check run for this annotation

Codecov / codecov/patch

crates/storage/src/migration/m20240326_000003_create_activity_status.rs#L28-L29

Added lines #L28 - L29 were not covered by tests
.drop_table(
Table::drop()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub struct Migration;

#[async_trait::async_trait]
impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
async fn up(&self, manager: &'life1 SchemaManager<'_>) -> Result<(), DbErr> {
manager

Check warning on line 11 in crates/storage/src/migration/m20240326_000004_create_activity_kinds.rs

View check run for this annotation

Codecov / codecov/patch

crates/storage/src/migration/m20240326_000004_create_activity_kinds.rs#L10-L11

Added lines #L10 - L11 were not covered by tests
.create_table(
Table::create()
Expand All @@ -25,7 +25,7 @@ impl MigrationTrait for Migration {
.await

Check warning on line 25 in crates/storage/src/migration/m20240326_000004_create_activity_kinds.rs

View check run for this annotation

Codecov / codecov/patch

crates/storage/src/migration/m20240326_000004_create_activity_kinds.rs#L25

Added line #L25 was not covered by tests
}

async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
async fn down(&self, manager: &'life1 SchemaManager<'_>) -> Result<(), DbErr> {
manager

Check warning on line 29 in crates/storage/src/migration/m20240326_000004_create_activity_kinds.rs

View check run for this annotation

Codecov / codecov/patch

crates/storage/src/migration/m20240326_000004_create_activity_kinds.rs#L28-L29

Added lines #L28 - L29 were not covered by tests
.drop_table(
Table::drop()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub struct Migration;

#[async_trait::async_trait]
impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
async fn up(&self, manager: &'life1 SchemaManager<'_>) -> Result<(), DbErr> {
manager

Check warning on line 13 in crates/storage/src/migration/m20240326_000005_create_activities_tags.rs

View check run for this annotation

Codecov / codecov/patch

crates/storage/src/migration/m20240326_000005_create_activities_tags.rs#L12-L13

Added lines #L12 - L13 were not covered by tests
.create_table(
Table::create()
Expand Down Expand Up @@ -48,7 +48,7 @@ impl MigrationTrait for Migration {
.await

Check warning on line 48 in crates/storage/src/migration/m20240326_000005_create_activities_tags.rs

View check run for this annotation

Codecov / codecov/patch

crates/storage/src/migration/m20240326_000005_create_activities_tags.rs#L48

Added line #L48 was not covered by tests
}

async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
async fn down(&self, manager: &'life1 SchemaManager<'_>) -> Result<(), DbErr> {
manager

Check warning on line 52 in crates/storage/src/migration/m20240326_000005_create_activities_tags.rs

View check run for this annotation

Codecov / codecov/patch

crates/storage/src/migration/m20240326_000005_create_activities_tags.rs#L51-L52

Added lines #L51 - L52 were not covered by tests
.drop_table(
Table::drop()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub struct Migration;

#[async_trait::async_trait]
impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
async fn up(&self, manager: &'life1 SchemaManager<'_>) -> Result<(), DbErr> {
manager

Check warning on line 13 in crates/storage/src/migration/m20240326_000006_create_activities_categories.rs

View check run for this annotation

Codecov / codecov/patch

crates/storage/src/migration/m20240326_000006_create_activities_categories.rs#L12-L13

Added lines #L12 - L13 were not covered by tests
.create_table(
Table::create()
Expand Down Expand Up @@ -54,7 +54,7 @@ impl MigrationTrait for Migration {
.await

Check warning on line 54 in crates/storage/src/migration/m20240326_000006_create_activities_categories.rs

View check run for this annotation

Codecov / codecov/patch

crates/storage/src/migration/m20240326_000006_create_activities_categories.rs#L54

Added line #L54 was not covered by tests
}

async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
async fn down(&self, manager: &'life1 SchemaManager<'_>) -> Result<(), DbErr> {
manager

Check warning on line 58 in crates/storage/src/migration/m20240326_000006_create_activities_categories.rs

View check run for this annotation

Codecov / codecov/patch

crates/storage/src/migration/m20240326_000006_create_activities_categories.rs#L57-L58

Added lines #L57 - L58 were not covered by tests
.drop_table(
Table::drop()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub struct Migration;

#[async_trait::async_trait]
impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
async fn up(&self, manager: &'life1 SchemaManager<'_>) -> Result<(), DbErr> {
let activity_kinds = ActivityStatusKind::iter()
.map(|kind| {
Query::insert()
Expand All @@ -30,7 +30,7 @@ impl MigrationTrait for Migration {
Ok(())

Check warning on line 30 in crates/storage/src/migration/m20240327_000001_create_activity_status_values.rs

View check run for this annotation

Codecov / codecov/patch

crates/storage/src/migration/m20240327_000001_create_activity_status_values.rs#L30

Added line #L30 was not covered by tests
}

async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
async fn down(&self, manager: &'life1 SchemaManager<'_>) -> Result<(), DbErr> {
manager

Check warning on line 34 in crates/storage/src/migration/m20240327_000001_create_activity_status_values.rs

View check run for this annotation

Codecov / codecov/patch

crates/storage/src/migration/m20240327_000001_create_activity_status_values.rs#L33-L34

Added lines #L33 - L34 were not covered by tests
.exec_stmt(
Query::delete()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub struct Migration;

#[async_trait::async_trait]
impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
async fn up(&self, manager: &'life1 SchemaManager<'_>) -> Result<(), DbErr> {
let activity_kinds = ActivityKind::iter()
.map(|kind| {
Query::insert()
Expand All @@ -29,7 +29,7 @@ impl MigrationTrait for Migration {
Ok(())

Check warning on line 29 in crates/storage/src/migration/m20240327_000002_create_activity_kind_values.rs

View check run for this annotation

Codecov / codecov/patch

crates/storage/src/migration/m20240327_000002_create_activity_kind_values.rs#L29

Added line #L29 was not covered by tests
}

async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
async fn down(&self, manager: &'life1 SchemaManager<'_>) -> Result<(), DbErr> {
manager

Check warning on line 33 in crates/storage/src/migration/m20240327_000002_create_activity_kind_values.rs

View check run for this annotation

Codecov / codecov/patch

crates/storage/src/migration/m20240327_000002_create_activity_kind_values.rs#L32-L33

Added lines #L32 - L33 were not covered by tests
.exec_stmt(
Query::delete()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub struct Migration;

#[async_trait::async_trait]
impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
async fn up(&self, manager: &'life1 SchemaManager<'_>) -> Result<(), DbErr> {
manager

Check warning on line 11 in crates/storage/src/migration/m20240329_000001_create_descriptions.rs

View check run for this annotation

Codecov / codecov/patch

crates/storage/src/migration/m20240329_000001_create_descriptions.rs#L10-L11

Added lines #L10 - L11 were not covered by tests
.create_table(
Table::create()
Expand All @@ -29,7 +29,7 @@ impl MigrationTrait for Migration {
.await

Check warning on line 29 in crates/storage/src/migration/m20240329_000001_create_descriptions.rs

View check run for this annotation

Codecov / codecov/patch

crates/storage/src/migration/m20240329_000001_create_descriptions.rs#L29

Added line #L29 was not covered by tests
}

async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
async fn down(&self, manager: &'life1 SchemaManager<'_>) -> Result<(), DbErr> {
manager

Check warning on line 33 in crates/storage/src/migration/m20240329_000001_create_descriptions.rs

View check run for this annotation

Codecov / codecov/patch

crates/storage/src/migration/m20240329_000001_create_descriptions.rs#L32-L33

Added lines #L32 - L33 were not covered by tests
.drop_table(
Table::drop()
Expand Down

0 comments on commit e73d00f

Please sign in to comment.