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

Replace SeaORM's ColumnType and IdenStatic with its SeaQuery's counterparts #1390

Closed
wants to merge 9 commits into from

Conversation

billy1624
Copy link
Member

@billy1624 billy1624 commented Jan 12, 2023

PR Info

Breaking Changes

  • Changed the return type of EntityName::table_name to be &'static str
impl EntityName for Entity {
-   fn table_name(&self) -> &str {
+   fn table_name(&self) -> &'static str {
        "fruit"
    }
}
  • sea_orm::IdenStatic was replaced by sea_query::IdenStatic
  • Identity was being moved into sea_query
  • IntoIdentity was being moved into sea_query
  • sea_orm::ColumnType was replaced by sea_query::ColumnType
  • ColumnType::Custom takes sea_query::DynIden instead of String
// Compact Entity
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
#[sea_orm(table_name = "fruit")]
pub struct Model {
-   #[sea_orm(column_type = r#"Custom("citext".to_owned())"#)]
+   #[sea_orm(column_type = r#"custom("citext")"#)]
    pub column: String,
}
// Expanded Entity
impl ColumnTrait for Column {
    type EntityName = Entity;

    fn def(&self) -> ColumnDef {
        match self {
-           Self::Column => ColumnType::Custom("citext".to_owned()).def(),
+           Self::Column => ColumnType::custom("citext").def(),
        }
    }
}
  • ColumnType::Binary became a tuple variant which take sea_query::BlobSize
  • Methods ColumnType::def was being moved into ColumnTypeTrait

@billy1624 billy1624 marked this pull request as ready for review January 12, 2023 09:19
@billy1624 billy1624 requested a review from tyt2y3 January 12, 2023 09:36
@billy1624 billy1624 marked this pull request as draft January 14, 2023 11:09
@billy1624
Copy link
Member Author

This PR was being splitted into two:

@billy1624 billy1624 closed this Jan 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Replace SeaORM's ColumnType and IdenStatic with its SeaQuery's counterparts
1 participant