This commit is contained in:
Billy Chan 2021-08-18 12:47:01 +08:00 committed by Chris Tsang
parent 6ec985dbd8
commit 2db5c5e8c9
3 changed files with 11 additions and 5 deletions

View File

@ -22,13 +22,13 @@ clap = { version = "^2.33.3" }
dotenv = { version = "^0.15" }
async-std = { version = "^1.9", features = [ "attributes" ] }
sea-orm = { version = "^0.1", features = [ "sqlx-all" ] }
sea-orm-codegen = { version = "^0.1" }
sea-orm-codegen = { version = "^0.1", path = "../sea-orm-codegen" }
sea-schema = { version = "^0.2.4", default-features = false, features = [
"sqlx-mysql",
"sqlx-postgres",
"discovery",
"writer",
] }
], git = "https://github.com/SeaQL/sea-schema.git", branch = "pg-pk-generated-expr" }
sqlx = { version = "^0.5", default-features = false, features = [ "mysql", "postgres" ] }
[features]

View File

@ -15,7 +15,7 @@ name = "sea_orm_codegen"
path = "src/lib.rs"
[dependencies]
sea-query = { version = "^0.12.8" }
sea-query = { version = "^0.14" }
syn = { version = "^1", default-features = false, features = [
"derive",
"parsing",

View File

@ -285,7 +285,7 @@ mod tests {
#[test]
fn test_from_column_def() {
let column: Column = ColumnDef::new(Alias::new("id")).string().into();
let column: Column = ColumnDef::new(Alias::new("id")).string().to_owned().into();
assert_eq!(
column.get_def().to_string(),
quote! {
@ -294,13 +294,18 @@ mod tests {
.to_string()
);
let column: Column = ColumnDef::new(Alias::new("id")).string().not_null().into();
let column: Column = ColumnDef::new(Alias::new("id"))
.string()
.not_null()
.to_owned()
.into();
assert!(column.not_null);
let column: Column = ColumnDef::new(Alias::new("id"))
.string()
.unique_key()
.not_null()
.to_owned()
.into();
assert!(column.unique);
assert!(column.not_null);
@ -310,6 +315,7 @@ mod tests {
.auto_increment()
.unique_key()
.not_null()
.to_owned()
.into();
assert!(column.auto_increment);
assert!(column.unique);