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

eth-bytecode-db-extractors - extract job queue #652

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

rimrakhimov
Copy link
Member

@rimrakhimov rimrakhimov commented Oct 30, 2023

Extracts job queue related functionality into a separate crate, so that it could be reused between different extractors

@rimrakhimov rimrakhimov changed the title eth-bytecode-db-extractors - extract job queue into a separate crate eth-bytecode-db-extractors - extract job queue Oct 30, 2023
Comment on lines +1 to +16
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.2

use sea_orm::entity::prelude::*;

#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
#[sea_orm(table_name = "seaql_migrations")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub version: String,
pub applied_at: i64,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {}

impl ActiveModelBehavior for ActiveModel {}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe remove useless codegen?

Comment on lines +70 to +76
create_extension_pgcrypto,
create_function_job_queue_set_modified_at,
create_enum_job_status,
create_table_job_queue,
create_index_job_queue_status,
create_trigger_job_queue_set_modified_at,
create_function_insert_job,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tbh, I don't like the idea that you declare 7 variables and then copypaste them here. if you miss some variable or write it twice, compiler wont tell you and it will be hard to spot the mistake.

Maybe write them inside &[] and add -- sql comment if you need some kind of names for your sql statements

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same problem with fn down()

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, I see that you use the same approach in blockscout-migration... okay, then we can leave it as it is for consistency :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem here is that you cannot put a single string with several sql statements into Statement::from_string. Usually we are using from_sql method for that cases that internally split all statements based on ';'. But in functions we use ";" internally and thus, the approach with splitting cannot be applied here. That is why we need a separate statements

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants