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" } dotenv = { version = "^0.15" }
async-std = { version = "^1.9", features = [ "attributes" ] } async-std = { version = "^1.9", features = [ "attributes" ] }
sea-orm = { version = "^0.1", features = [ "sqlx-all" ] } 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 = [ sea-schema = { version = "^0.2.4", default-features = false, features = [
"sqlx-mysql", "sqlx-mysql",
"sqlx-postgres", "sqlx-postgres",
"discovery", "discovery",
"writer", "writer",
] } ], git = "https://github.com/SeaQL/sea-schema.git", branch = "pg-pk-generated-expr" }
sqlx = { version = "^0.5", default-features = false, features = [ "mysql", "postgres" ] } sqlx = { version = "^0.5", default-features = false, features = [ "mysql", "postgres" ] }
[features] [features]

View File

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

View File

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