Revert sea-orm-codegen
This commit is contained in:
parent
94eac96513
commit
d4f8e7226e
@ -15,14 +15,9 @@ pub struct Entity {
|
|||||||
pub(crate) relations: Vec<Relation>,
|
pub(crate) relations: Vec<Relation>,
|
||||||
pub(crate) conjunct_relations: Vec<ConjunctRelation>,
|
pub(crate) conjunct_relations: Vec<ConjunctRelation>,
|
||||||
pub(crate) primary_keys: Vec<PrimaryKey>,
|
pub(crate) primary_keys: Vec<PrimaryKey>,
|
||||||
pub(crate) comment: Option<String>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Entity {
|
impl Entity {
|
||||||
pub fn get_table_comment(&self) -> Option<&String> {
|
|
||||||
self.comment.as_ref()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn get_table_name_snake_case(&self) -> String {
|
pub fn get_table_name_snake_case(&self) -> String {
|
||||||
self.table_name.to_snake_case()
|
self.table_name.to_snake_case()
|
||||||
}
|
}
|
||||||
@ -323,7 +318,6 @@ mod tests {
|
|||||||
primary_keys: vec![PrimaryKey {
|
primary_keys: vec![PrimaryKey {
|
||||||
name: "id".to_owned(),
|
name: "id".to_owned(),
|
||||||
}],
|
}],
|
||||||
comment: None,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,14 +117,12 @@ impl EntityTransformer {
|
|||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
let comment = table_create.get_comment().cloned();
|
|
||||||
let entity = Entity {
|
let entity = Entity {
|
||||||
table_name: table_name.clone(),
|
table_name: table_name.clone(),
|
||||||
columns,
|
columns,
|
||||||
relations: relations.clone(),
|
relations: relations.clone(),
|
||||||
conjunct_relations: vec![],
|
conjunct_relations: vec![],
|
||||||
primary_keys,
|
primary_keys,
|
||||||
comment,
|
|
||||||
};
|
};
|
||||||
entities.insert(table_name.clone(), entity.clone());
|
entities.insert(table_name.clone(), entity.clone());
|
||||||
for mut rel in relations.into_iter() {
|
for mut rel in relations.into_iter() {
|
||||||
|
@ -785,7 +785,6 @@ impl EntityWriter {
|
|||||||
},
|
},
|
||||||
None => quote! {},
|
None => quote! {},
|
||||||
};
|
};
|
||||||
|
|
||||||
let extra_derive = with_serde.extra_derive();
|
let extra_derive = with_serde.extra_derive();
|
||||||
|
|
||||||
quote! {
|
quote! {
|
||||||
@ -883,11 +882,9 @@ mod tests {
|
|||||||
primary_keys: vec![PrimaryKey {
|
primary_keys: vec![PrimaryKey {
|
||||||
name: "id".to_owned(),
|
name: "id".to_owned(),
|
||||||
}],
|
}],
|
||||||
comment: None,
|
|
||||||
},
|
},
|
||||||
Entity {
|
Entity {
|
||||||
table_name: "_cake_filling_".to_owned(),
|
table_name: "_cake_filling_".to_owned(),
|
||||||
comment: None,
|
|
||||||
columns: vec![
|
columns: vec![
|
||||||
Column {
|
Column {
|
||||||
name: "cake_id".to_owned(),
|
name: "cake_id".to_owned(),
|
||||||
@ -983,7 +980,6 @@ mod tests {
|
|||||||
name: "filling_id".to_owned(),
|
name: "filling_id".to_owned(),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
comment: None,
|
|
||||||
},
|
},
|
||||||
Entity {
|
Entity {
|
||||||
table_name: "filling".to_owned(),
|
table_name: "filling".to_owned(),
|
||||||
@ -1011,7 +1007,6 @@ mod tests {
|
|||||||
primary_keys: vec![PrimaryKey {
|
primary_keys: vec![PrimaryKey {
|
||||||
name: "id".to_owned(),
|
name: "id".to_owned(),
|
||||||
}],
|
}],
|
||||||
comment: None,
|
|
||||||
},
|
},
|
||||||
Entity {
|
Entity {
|
||||||
table_name: "fruit".to_owned(),
|
table_name: "fruit".to_owned(),
|
||||||
@ -1066,7 +1061,6 @@ mod tests {
|
|||||||
primary_keys: vec![PrimaryKey {
|
primary_keys: vec![PrimaryKey {
|
||||||
name: "id".to_owned(),
|
name: "id".to_owned(),
|
||||||
}],
|
}],
|
||||||
comment: None,
|
|
||||||
},
|
},
|
||||||
Entity {
|
Entity {
|
||||||
table_name: "vendor".to_owned(),
|
table_name: "vendor".to_owned(),
|
||||||
@ -1108,7 +1102,6 @@ mod tests {
|
|||||||
primary_keys: vec![PrimaryKey {
|
primary_keys: vec![PrimaryKey {
|
||||||
name: "id".to_owned(),
|
name: "id".to_owned(),
|
||||||
}],
|
}],
|
||||||
comment: None,
|
|
||||||
},
|
},
|
||||||
Entity {
|
Entity {
|
||||||
table_name: "rust_keyword".to_owned(),
|
table_name: "rust_keyword".to_owned(),
|
||||||
@ -1266,7 +1259,6 @@ mod tests {
|
|||||||
primary_keys: vec![PrimaryKey {
|
primary_keys: vec![PrimaryKey {
|
||||||
name: "id".to_owned(),
|
name: "id".to_owned(),
|
||||||
}],
|
}],
|
||||||
comment: None,
|
|
||||||
},
|
},
|
||||||
Entity {
|
Entity {
|
||||||
table_name: "cake_with_float".to_owned(),
|
table_name: "cake_with_float".to_owned(),
|
||||||
@ -1311,7 +1303,6 @@ mod tests {
|
|||||||
primary_keys: vec![PrimaryKey {
|
primary_keys: vec![PrimaryKey {
|
||||||
name: "id".to_owned(),
|
name: "id".to_owned(),
|
||||||
}],
|
}],
|
||||||
comment: None,
|
|
||||||
},
|
},
|
||||||
Entity {
|
Entity {
|
||||||
table_name: "cake_with_double".to_owned(),
|
table_name: "cake_with_double".to_owned(),
|
||||||
@ -1356,7 +1347,6 @@ mod tests {
|
|||||||
primary_keys: vec![PrimaryKey {
|
primary_keys: vec![PrimaryKey {
|
||||||
name: "id".to_owned(),
|
name: "id".to_owned(),
|
||||||
}],
|
}],
|
||||||
comment: None,
|
|
||||||
},
|
},
|
||||||
Entity {
|
Entity {
|
||||||
table_name: "collection".to_owned(),
|
table_name: "collection".to_owned(),
|
||||||
@ -1388,7 +1378,6 @@ mod tests {
|
|||||||
primary_keys: vec![PrimaryKey {
|
primary_keys: vec![PrimaryKey {
|
||||||
name: "id".to_owned(),
|
name: "id".to_owned(),
|
||||||
}],
|
}],
|
||||||
comment: None,
|
|
||||||
},
|
},
|
||||||
Entity {
|
Entity {
|
||||||
table_name: "collection_float".to_owned(),
|
table_name: "collection_float".to_owned(),
|
||||||
@ -1420,7 +1409,6 @@ mod tests {
|
|||||||
primary_keys: vec![PrimaryKey {
|
primary_keys: vec![PrimaryKey {
|
||||||
name: "id".to_owned(),
|
name: "id".to_owned(),
|
||||||
}],
|
}],
|
||||||
comment: None,
|
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -1782,7 +1770,6 @@ mod tests {
|
|||||||
fn test_gen_with_seaography() -> io::Result<()> {
|
fn test_gen_with_seaography() -> io::Result<()> {
|
||||||
let cake_entity = Entity {
|
let cake_entity = Entity {
|
||||||
table_name: "cake".to_owned(),
|
table_name: "cake".to_owned(),
|
||||||
comment: None,
|
|
||||||
columns: vec![
|
columns: vec![
|
||||||
Column {
|
Column {
|
||||||
name: "id".to_owned(),
|
name: "id".to_owned(),
|
||||||
@ -2238,7 +2225,6 @@ mod tests {
|
|||||||
primary_keys: vec![PrimaryKey {
|
primary_keys: vec![PrimaryKey {
|
||||||
name: "id".to_owned(),
|
name: "id".to_owned(),
|
||||||
}],
|
}],
|
||||||
comment: None,
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
const ENTITY_FILES: [&str; 1] = [include_str!("../../tests/postgres/binary_json.rs")];
|
const ENTITY_FILES: [&str; 1] = [include_str!("../../tests/postgres/binary_json.rs")];
|
||||||
@ -2322,7 +2308,6 @@ mod tests {
|
|||||||
let entities = vec![
|
let entities = vec![
|
||||||
Entity {
|
Entity {
|
||||||
table_name: "tea_pairing".to_owned(),
|
table_name: "tea_pairing".to_owned(),
|
||||||
comment: None,
|
|
||||||
columns: vec![
|
columns: vec![
|
||||||
Column {
|
Column {
|
||||||
name: "id".to_owned(),
|
name: "id".to_owned(),
|
||||||
@ -2366,7 +2351,6 @@ mod tests {
|
|||||||
},
|
},
|
||||||
Entity {
|
Entity {
|
||||||
table_name: "tea_pairing_with_size".to_owned(),
|
table_name: "tea_pairing_with_size".to_owned(),
|
||||||
comment: None,
|
|
||||||
columns: vec![
|
columns: vec![
|
||||||
Column {
|
Column {
|
||||||
name: "id".to_owned(),
|
name: "id".to_owned(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user