-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
aggregator config api (client-side) (#340)
--------- Co-authored-by: Tim Geoghegan <[email protected]>
- Loading branch information
1 parent
ddcce58
commit a63b6b1
Showing
27 changed files
with
840 additions
and
281 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
migration/src/m20230725_220134_add_vdafs_and_query_types_to_aggregators.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
use sea_orm_migration::prelude::*; | ||
use serde_json::json; | ||
|
||
#[derive(DeriveMigrationName)] | ||
pub struct Migration; | ||
|
||
#[async_trait::async_trait] | ||
impl MigrationTrait for Migration { | ||
async fn up(&self, db: &SchemaManager) -> Result<(), DbErr> { | ||
db.alter_table( | ||
TableAlterStatement::new() | ||
.table(Aggregator::Table) | ||
.add_column(ColumnDef::new(Aggregator::Vdafs).json().null()) | ||
.add_column(ColumnDef::new(Aggregator::QueryTypes).json().null()) | ||
.to_owned(), | ||
) | ||
.await?; | ||
|
||
db.exec_stmt( | ||
Query::update() | ||
.table(Aggregator::Table) | ||
.values([ | ||
( | ||
Aggregator::Vdafs, | ||
json!(["Prio3Count", "Prio3Sum", "Prio3Histogram"]).into(), | ||
), | ||
( | ||
Aggregator::QueryTypes, | ||
json!(["TimeInterval", "FixedSize"]).into(), | ||
), | ||
]) | ||
.to_owned(), | ||
) | ||
.await?; | ||
|
||
db.alter_table( | ||
TableAlterStatement::new() | ||
.table(Aggregator::Table) | ||
.modify_column(ColumnDef::new(Aggregator::Vdafs).not_null()) | ||
.modify_column(ColumnDef::new(Aggregator::QueryTypes).not_null()) | ||
.to_owned(), | ||
) | ||
.await?; | ||
|
||
Ok(()) | ||
} | ||
|
||
async fn down(&self, db: &SchemaManager) -> Result<(), DbErr> { | ||
db.alter_table( | ||
TableAlterStatement::new() | ||
.table(Aggregator::Table) | ||
.drop_column(Aggregator::Vdafs) | ||
.drop_column(Aggregator::QueryTypes) | ||
.to_owned(), | ||
) | ||
.await?; | ||
Ok(()) | ||
} | ||
} | ||
|
||
/// Learn more at https://docs.rs/sea-query#iden | ||
#[derive(Iden)] | ||
enum Aggregator { | ||
Table, | ||
Vdafs, | ||
QueryTypes, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.