From e911d2f5f42a9369120f163806114b00459ae914 Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Thu, 21 Oct 2021 11:36:57 +0800 Subject: [PATCH 01/16] Unify case-transform using the same crate --- .github/workflows/rust.yml | 8 ++++++- issues/262/Cargo.toml | 12 ++++++++++ issues/262/src/cake.rs | 26 ++++++++++++++++++++++ issues/262/src/main.rs | 14 ++++++++++++ sea-orm-macros/Cargo.toml | 1 - sea-orm-macros/src/derives/entity_model.rs | 4 ++-- 6 files changed, 61 insertions(+), 4 deletions(-) create mode 100644 issues/262/Cargo.toml create mode 100644 issues/262/src/cake.rs create mode 100644 issues/262/src/main.rs diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index c9073f5c..c4112860 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -208,7 +208,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - path: [86] + path: [86, 249, 262] steps: - uses: actions/checkout@v2 @@ -224,6 +224,12 @@ jobs: args: > --manifest-path issues/${{ matrix.path }}/Cargo.toml + - uses: actions-rs/cargo@v1 + with: + command: test + args: > + --manifest-path issues/${{ matrix.path }}/Cargo.toml + sqlite: name: SQLite runs-on: ubuntu-20.04 diff --git a/issues/262/Cargo.toml b/issues/262/Cargo.toml new file mode 100644 index 00000000..ad34d61c --- /dev/null +++ b/issues/262/Cargo.toml @@ -0,0 +1,12 @@ +[workspace] +# A separate workspace + +[package] +name = "sea-orm-issues-262" +version = "0.1.0" +edition = "2018" +publish = false + +[dependencies] +sea-orm = { path = "../../", features = [ "sqlx-all", "runtime-async-std-native-tls", "debug-print" ] } +async-std = { version = "^1", features = ["attributes"] } diff --git a/issues/262/src/cake.rs b/issues/262/src/cake.rs new file mode 100644 index 00000000..08ae70ae --- /dev/null +++ b/issues/262/src/cake.rs @@ -0,0 +1,26 @@ +use sea_orm::entity::prelude::*; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] +#[sea_orm(table_name = "cake")] +pub struct Model { + #[sea_orm(primary_key)] + pub id: i32, + pub md5hash: String, + pub md5_hash: String, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation {} + +impl ActiveModelBehavior for ActiveModel {} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_case_transform_1() { + assert_eq!(Column::Md5hash.to_string().as_str(), "md5hash"); + assert_eq!(Column::Md5Hash.to_string().as_str(), "md5_hash"); + } +} diff --git a/issues/262/src/main.rs b/issues/262/src/main.rs new file mode 100644 index 00000000..030325ad --- /dev/null +++ b/issues/262/src/main.rs @@ -0,0 +1,14 @@ +mod cake; +use sea_orm::*; + +#[async_std::main] +pub async fn main() { + let db = Database::connect("mysql://sea:sea@localhost/bakery") + .await + .unwrap(); + + async_std::task::spawn(async move { + cake::Entity::find().one(&db).await.unwrap(); + }) + .await; +} diff --git a/sea-orm-macros/Cargo.toml b/sea-orm-macros/Cargo.toml index aabcf079..6cc73bca 100644 --- a/sea-orm-macros/Cargo.toml +++ b/sea-orm-macros/Cargo.toml @@ -21,4 +21,3 @@ syn = { version = "^1", default-features = false, features = [ "full", "derive", quote = "^1" heck = "^0.3" proc-macro2 = "^1" -convert_case = "0.4" diff --git a/sea-orm-macros/src/derives/entity_model.rs b/sea-orm-macros/src/derives/entity_model.rs index 3b0dac26..3329731a 100644 --- a/sea-orm-macros/src/derives/entity_model.rs +++ b/sea-orm-macros/src/derives/entity_model.rs @@ -1,5 +1,5 @@ use crate::util::{escape_rust_keyword, trim_starting_raw_identifier}; -use convert_case::{Case, Casing}; +use heck::CamelCase; use proc_macro2::{Ident, Span, TokenStream}; use quote::quote; use syn::{ @@ -62,7 +62,7 @@ pub fn expand_derive_entity_model(data: Data, attrs: Vec) -> syn::Res for field in fields.named { if let Some(ident) = &field.ident { let mut field_name = Ident::new( - &trim_starting_raw_identifier(&ident).to_case(Case::Pascal), + &trim_starting_raw_identifier(&ident).to_camel_case(), Span::call_site(), ); From b65d441deaed98a8441e34ad134939defbf75d85 Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Thu, 21 Oct 2021 16:26:42 +0800 Subject: [PATCH 02/16] Fix clippy warnings --- sea-orm-codegen/src/entity/writer.rs | 2 +- src/entity/column.rs | 1 + src/tests_cfg/rust_keyword.rs | 4 +--- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/sea-orm-codegen/src/entity/writer.rs b/sea-orm-codegen/src/entity/writer.rs index b3614177..be3c47bb 100644 --- a/sea-orm-codegen/src/entity/writer.rs +++ b/sea-orm-codegen/src/entity/writer.rs @@ -934,7 +934,7 @@ mod tests { } let content = lines.join(""); let expected: TokenStream = content.parse().unwrap(); - let generated = generator(&cake_entity, &entity_serde_variant.1) + let generated = generator(cake_entity, &entity_serde_variant.1) .into_iter() .fold(TokenStream::new(), |mut acc, tok| { acc.extend(tok); diff --git a/src/entity/column.rs b/src/entity/column.rs index a27215e5..b7ce2820 100644 --- a/src/entity/column.rs +++ b/src/entity/column.rs @@ -669,6 +669,7 @@ mod tests { fn column_name_enum_name_1() { use sea_query::Iden; + #[allow(clippy::enum_variant_names)] mod hello { use crate as sea_orm; use crate::entity::prelude::*; diff --git a/src/tests_cfg/rust_keyword.rs b/src/tests_cfg/rust_keyword.rs index c8662347..2163664f 100644 --- a/src/tests_cfg/rust_keyword.rs +++ b/src/tests_cfg/rust_keyword.rs @@ -67,9 +67,7 @@ pub enum Relation {} impl RelationTrait for Relation { fn def(&self) -> RelationDef { - match self { - _ => panic!("No RelationDef"), - } + panic!("No RelationDef") } } From d10a52cc58aa6570e330d97c3d0f234ef771bd70 Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Thu, 21 Oct 2021 18:25:35 +0800 Subject: [PATCH 03/16] Try skip CI job issues --- .github/workflows/rust.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index c4112860..da6749e3 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -211,20 +211,28 @@ jobs: path: [86, 249, 262] steps: - uses: actions/checkout@v2 + with: + fetch-depth: 0 - - uses: actions-rs/toolchain@v1 + - id: git-log + run: echo "::set-output name=message::$(git log --no-merges -1 --oneline)" + + - if: "contains(steps.git-log.outputs.message, '[issues]')" + uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: stable override: true - - uses: actions-rs/cargo@v1 + - if: "contains(steps.git-log.outputs.message, '[issues]')" + uses: actions-rs/cargo@v1 with: command: build args: > --manifest-path issues/${{ matrix.path }}/Cargo.toml - - uses: actions-rs/cargo@v1 + - if: "contains(steps.git-log.outputs.message, '[issues]')" + uses: actions-rs/cargo@v1 with: command: test args: > From 56e2f7c0e91bd3c79de583769a4b190b42a9102a Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Thu, 21 Oct 2021 19:08:58 +0800 Subject: [PATCH 04/16] Add empty line... --- .github/workflows/rust.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index da6749e3..110b2317 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -202,6 +202,7 @@ jobs: args: > --manifest-path examples/${{ matrix.path }}/Cargo.toml + issues: name: Issues runs-on: ${{ matrix.os }} From b65de654644d7ff253c94e03daad909a1ec69f6c Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Thu, 21 Oct 2021 19:09:38 +0800 Subject: [PATCH 05/16] [issues] The CI issues job should be running --- .github/workflows/rust.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 110b2317..da6749e3 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -202,7 +202,6 @@ jobs: args: > --manifest-path examples/${{ matrix.path }}/Cargo.toml - issues: name: Issues runs-on: ${{ matrix.os }} From 44da1cab0b91753530d0ae55bf442d2f3ecfd559 Mon Sep 17 00:00:00 2001 From: Forest Anderson Date: Wed, 20 Oct 2021 11:50:10 -0400 Subject: [PATCH 06/16] Rearranged files, added fmt --- .github/workflows/rust.yml | 17 ++++++++---- sea-orm-cli/src/main.rs | 1 - src/query/util.rs | 55 +++++++++++++++++++++++++------------- 3 files changed, 48 insertions(+), 25 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index da6749e3..5bbc4a4d 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -11,9 +11,8 @@ env: CARGO_TERM_COLOR: always jobs: - - clippy: - name: Clippy + clippy-fmt: + name: Clippy + Fmt runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 @@ -22,9 +21,17 @@ jobs: with: profile: minimal toolchain: stable - components: clippy + components: clippy, rustfmt override: true - + + # Make sure files are formatted + - uses: actions-rs/cargo@v1 + with: + command: fmt + args: > + --all + + # Run clippy - uses: actions-rs/clippy-check@v1 with: token: ${{ secrets.GITHUB_TOKEN }} diff --git a/sea-orm-cli/src/main.rs b/sea-orm-cli/src/main.rs index 2529b0f1..2c7848ce 100644 --- a/sea-orm-cli/src/main.rs +++ b/sea-orm-cli/src/main.rs @@ -50,7 +50,6 @@ async fn run_generate_command(matches: &ArgMatches<'_>) -> Result<(), Box Date: Thu, 21 Oct 2021 16:14:42 +0800 Subject: [PATCH 07/16] CI install sea-orm-cli in debug mode --- .github/workflows/rust.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 5bbc4a4d..7bc5ef24 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -186,6 +186,7 @@ jobs: command: install args: > --path sea-orm-cli + --debug examples: name: Examples From 5daa9abd38fde08debde86cadada198e935b34cb Mon Sep 17 00:00:00 2001 From: Chris Tsang Date: Sat, 23 Oct 2021 15:41:16 +0800 Subject: [PATCH 08/16] #267 Added `is_null` and `is_not_null` --- src/entity/column.rs | 13 ++++++++----- src/query/helper.rs | 12 ++++++++++++ 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/entity/column.rs b/src/entity/column.rs index b7ce2820..423e3e3b 100644 --- a/src/entity/column.rs +++ b/src/entity/column.rs @@ -47,8 +47,9 @@ macro_rules! bind_oper { }; } -macro_rules! bind_agg_func { +macro_rules! bind_func_no_params { ( $func: ident ) => { + /// See also SeaQuery's method with same name. fn $func(&self) -> SimpleExpr { Expr::tbl(self.entity_name(), *self).$func() } @@ -213,10 +214,12 @@ pub trait ColumnTrait: IdenStatic + Iterable + FromStr { Expr::tbl(self.entity_name(), *self).like(&pattern) } - bind_agg_func!(max); - bind_agg_func!(min); - bind_agg_func!(sum); - bind_agg_func!(count); + bind_func_no_params!(max); + bind_func_no_params!(min); + bind_func_no_params!(sum); + bind_func_no_params!(count); + bind_func_no_params!(is_null); + bind_func_no_params!(is_not_null); fn if_null(&self, v: V) -> SimpleExpr where diff --git a/src/query/helper.rs b/src/query/helper.rs index 7efe0ca1..bf762fc9 100644 --- a/src/query/helper.rs +++ b/src/query/helper.rs @@ -340,6 +340,18 @@ pub trait QueryFilter: Sized { /// r#"SELECT "cake"."id", "cake"."name" FROM "cake" WHERE (NOT (1 = 1 AND 2 = 2)) AND (3 = 3 OR 4 = 4)"# /// ); /// ``` + /// Use a sea_query expression + /// ``` + /// use sea_orm::{entity::*, query::*, sea_query::Expr, tests_cfg::fruit, DbBackend}; + /// + /// assert_eq!( + /// fruit::Entity::find() + /// .filter(Expr::col(fruit::Column::CakeId).is_null()) + /// .build(DbBackend::MySql) + /// .to_string(), + /// "SELECT `fruit`.`id`, `fruit`.`name`, `fruit`.`cake_id` FROM `fruit` WHERE `cake_id` IS NULL" + /// ); + /// ``` fn filter(mut self, filter: F) -> Self where F: IntoCondition, From 3cef4d5ebf4559953102d00f532c0708eadb7d28 Mon Sep 17 00:00:00 2001 From: Chris Tsang Date: Sat, 23 Oct 2021 16:00:02 +0800 Subject: [PATCH 09/16] sea-orm-codegen 0.3.1 --- sea-orm-codegen/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sea-orm-codegen/Cargo.toml b/sea-orm-codegen/Cargo.toml index e5219b0d..d062f1bc 100644 --- a/sea-orm-codegen/Cargo.toml +++ b/sea-orm-codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sea-orm-codegen" -version = "0.3.0" +version = "0.3.1" authors = ["Billy Chan "] edition = "2018" description = "Code Generator for SeaORM" From ada845de98b17323d63be6287319449293376323 Mon Sep 17 00:00:00 2001 From: Chris Tsang Date: Sat, 23 Oct 2021 16:01:09 +0800 Subject: [PATCH 10/16] sea-orm-cli 0.3.1 --- sea-orm-cli/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sea-orm-cli/Cargo.toml b/sea-orm-cli/Cargo.toml index 6512f61c..48e9d292 100644 --- a/sea-orm-cli/Cargo.toml +++ b/sea-orm-cli/Cargo.toml @@ -3,7 +3,7 @@ [package] name = "sea-orm-cli" -version = "0.3.0" +version = "0.3.1" authors = [ "Billy Chan " ] edition = "2018" description = "Command line utility for SeaORM" @@ -21,7 +21,7 @@ path = "src/main.rs" clap = { version = "^2.33.3" } dotenv = { version = "^0.15" } async-std = { version = "^1.9", features = [ "attributes" ] } -sea-orm-codegen = { version = "^0.3.0", path = "../sea-orm-codegen" } +sea-orm-codegen = { version = "^0.3.1", path = "../sea-orm-codegen" } sea-schema = { version = "^0.2.9", default-features = false, features = [ "debug-print", "sqlx-mysql", From 24df068ccad7699a5d8bd60fe3bd48bd9137de4c Mon Sep 17 00:00:00 2001 From: Chris Tsang Date: Sat, 23 Oct 2021 16:04:59 +0800 Subject: [PATCH 11/16] sea-orm-macros 0.3.1 --- sea-orm-macros/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sea-orm-macros/Cargo.toml b/sea-orm-macros/Cargo.toml index 6cc73bca..a3c52412 100644 --- a/sea-orm-macros/Cargo.toml +++ b/sea-orm-macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sea-orm-macros" -version = "0.3.0" +version = "0.3.1" authors = [ "Billy Chan " ] edition = "2018" description = "Derive macros for SeaORM" From 183ed5faa37ea801dca06d5ee06d733d24e83fc3 Mon Sep 17 00:00:00 2001 From: Chris Tsang Date: Sat, 23 Oct 2021 16:06:56 +0800 Subject: [PATCH 12/16] 0.3.1 --- CHANGELOG.md | 8 ++++++++ Cargo.toml | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cbe7f64e..1816fd14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## 0.3.1 - 2021-10-23 + +- [[#262]] Align case trasforms across derive macros +- [[#267]] Added `is_null` and `is_not_null` to `ColumnTrait` + +[#262]: https://github.com/SeaQL/sea-orm/issues/262 +[#267]: https://github.com/SeaQL/sea-orm/issues/267 + ## 0.3.0 - 2021-10-15 https://www.sea-ql.org/SeaORM/blog/2021-10-15-whats-new-in-0.3.0 diff --git a/Cargo.toml b/Cargo.toml index 71690374..9bda93ee 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ members = [".", "sea-orm-macros", "sea-orm-codegen"] [package] name = "sea-orm" -version = "0.3.0" +version = "0.3.1" authors = ["Chris Tsang "] edition = "2018" description = "🐚 An async & dynamic ORM for Rust" @@ -29,7 +29,7 @@ futures = { version = "^0.3" } futures-util = { version = "^0.3" } log = { version = "^0.4", optional = true } rust_decimal = { version = "^1", optional = true } -sea-orm-macros = { version = "^0.3.0", path = "sea-orm-macros", optional = true } +sea-orm-macros = { version = "^0.3.1", path = "sea-orm-macros", optional = true } sea-query = { version = "^0.18.0", features = ["thread-safe"] } sea-strum = { version = "^0.21", features = ["derive", "sea-orm"] } serde = { version = "^1.0", features = ["derive"] } From 128352092d937d032d326cc1922cccf5e26861d9 Mon Sep 17 00:00:00 2001 From: Billy Chan <30400950+billy1624@users.noreply.github.com> Date: Sat, 23 Oct 2021 15:50:33 +0800 Subject: [PATCH 13/16] GitHub Actions with Conditional Job Running Based on Commit Message (#266) * . * testing... * testing ... * [test] ... * . * .. * testing * [testing] * testing * [cli] this should only run cli * [CLI] how about this * [mysql] only * [postgres] only * [examples] only * [issues] only * [sqlite] only * Run by default * Always run example [cli] * ... * Run by default (again) * Docs * Remove unused * ... * [cli] [issues] only --- .github/workflows/rust.yml | 148 +++++++++++++++++++++++++++++++++---- 1 file changed, 133 insertions(+), 15 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 7bc5ef24..521238af 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,3 +1,53 @@ +# GitHub Actions with Conditional Job Running Based on Commit Message +# +# -------------------------------------------------------------------------------- +# +# Following jobs will always run +# +# - `clippy` +# - `test` +# - `examples` +# +# Following jobs will be run when no keywords were found in commit message) +# +# - `compile-sqlite` +# - `sqlite` +# - `compile-mysql` +# - `mysql` +# - `mariadb` +# - `compile-postgres` +# - `postgres` +# +# Following jobs will be run if keywords `[issues]` were found in commit message +# +# - Jobs that will always run +# - `issues` +# +# Following jobs will be run if keywords `[cli]` were found in commit message +# +# - Jobs that will always run +# - `cli` +# +# Following jobs will be run if keywords `[sqlite]` were found in commit message +# +# - Jobs that will always run +# - `compile-sqlite` +# - `sqlite` +# +# Following jobs will be run if keywords `[mysql]` were found in commit message +# +# - Jobs that will always run +# - `compile-mysql` +# - `mysql` +# - `mariadb` +# +# Following jobs will be run if keywords `[postgres]` were found in commit message +# +# - Jobs that will always run +# - `compile-postgres` +# - `postgres` + + name: tests on: @@ -11,6 +61,32 @@ env: CARGO_TERM_COLOR: always jobs: + + init: + name: Init + runs-on: ubuntu-20.04 + outputs: + run-sqlite: ${{ contains(steps.git-log.outputs.message, '[sqlite]') }} + run-mysql: ${{ contains(steps.git-log.outputs.message, '[mysql]') }} + run-postgres: ${{ contains(steps.git-log.outputs.message, '[postgres]') }} + run-cli: ${{ contains(steps.git-log.outputs.message, '[cli]') }} + run-issues: ${{ contains(steps.git-log.outputs.message, '[issues]') }} + run-partial: >- + ${{ + contains(steps.git-log.outputs.message, '[sqlite]') || + contains(steps.git-log.outputs.message, '[mysql]') || + contains(steps.git-log.outputs.message, '[postgres]') || + contains(steps.git-log.outputs.message, '[cli]') || + contains(steps.git-log.outputs.message, '[issues]') + }} + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - id: git-log + run: echo "::set-output name=message::$(git log --no-merges -1 --oneline)" + clippy-fmt: name: Clippy + Fmt runs-on: ubuntu-20.04 @@ -39,6 +115,12 @@ jobs: compile-sqlite: name: Compile SQLite + needs: init + if: >- + ${{ + needs.init.outputs.run-partial == 'false' || + (needs.init.outputs.run-partial == 'true' && needs.init.outputs.run-sqlite == 'true') + }} runs-on: ubuntu-20.04 strategy: matrix: @@ -72,6 +154,12 @@ jobs: compile-mysql: name: Compile MySQL + needs: init + if: >- + ${{ + needs.init.outputs.run-partial == 'false' || + (needs.init.outputs.run-partial == 'true' && needs.init.outputs.run-mysql == 'true') + }} runs-on: ubuntu-20.04 strategy: matrix: @@ -105,6 +193,12 @@ jobs: compile-postgres: name: Compile PostgreSQL + needs: init + if: >- + ${{ + needs.init.outputs.run-partial == 'false' || + (needs.init.outputs.run-partial == 'true' && needs.init.outputs.run-postgres == 'true') + }} runs-on: ubuntu-20.04 strategy: matrix: @@ -168,6 +262,8 @@ jobs: cli: name: CLI + needs: init + if: ${{ (needs.init.outputs.run-partial == 'true' && needs.init.outputs.run-cli == 'true') }} runs-on: ${{ matrix.os }} strategy: matrix: @@ -212,6 +308,8 @@ jobs: issues: name: Issues + needs: init + if: ${{ (needs.init.outputs.run-partial == 'true' && needs.init.outputs.run-issues == 'true') }} runs-on: ${{ matrix.os }} strategy: matrix: @@ -219,28 +317,20 @@ jobs: path: [86, 249, 262] steps: - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - id: git-log - run: echo "::set-output name=message::$(git log --no-merges -1 --oneline)" - - - if: "contains(steps.git-log.outputs.message, '[issues]')" - uses: actions-rs/toolchain@v1 + - uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: stable override: true - - if: "contains(steps.git-log.outputs.message, '[issues]')" - uses: actions-rs/cargo@v1 + - uses: actions-rs/cargo@v1 with: command: build args: > --manifest-path issues/${{ matrix.path }}/Cargo.toml - - if: "contains(steps.git-log.outputs.message, '[issues]')" - uses: actions-rs/cargo@v1 + - uses: actions-rs/cargo@v1 with: command: test args: > @@ -248,8 +338,15 @@ jobs: sqlite: name: SQLite + needs: + - init + - compile-sqlite + if: >- + ${{ + needs.init.outputs.run-partial == 'false' || + (needs.init.outputs.run-partial == 'true' && needs.init.outputs.run-sqlite == 'true') + }} runs-on: ubuntu-20.04 - needs: compile-sqlite env: DATABASE_URL: "sqlite::memory:" strategy: @@ -283,8 +380,15 @@ jobs: mysql: name: MySQL + needs: + - init + - compile-mysql + if: >- + ${{ + needs.init.outputs.run-partial == 'false' || + (needs.init.outputs.run-partial == 'true' && needs.init.outputs.run-mysql == 'true') + }} runs-on: ubuntu-20.04 - needs: compile-mysql env: DATABASE_URL: "mysql://root:@localhost" strategy: @@ -336,8 +440,15 @@ jobs: mariadb: name: MariaDB + needs: + - init + - compile-mysql + if: >- + ${{ + needs.init.outputs.run-partial == 'false' || + (needs.init.outputs.run-partial == 'true' && needs.init.outputs.run-mysql == 'true') + }} runs-on: ubuntu-20.04 - needs: compile-mysql env: DATABASE_URL: "mysql://root:@localhost" strategy: @@ -389,8 +500,15 @@ jobs: postgres: name: Postgres + needs: + - init + - compile-postgres + if: >- + ${{ + needs.init.outputs.run-partial == 'false' || + (needs.init.outputs.run-partial == 'true' && needs.init.outputs.run-postgres == 'true') + }} runs-on: ubuntu-20.04 - needs: compile-postgres env: DATABASE_URL: "postgres://root:root@localhost" strategy: From e2c8d32eab8e37cc435f5487aee2b79947477cc5 Mon Sep 17 00:00:00 2001 From: Chris Tsang Date: Sat, 23 Oct 2021 18:00:47 +0800 Subject: [PATCH 14/16] Update CHANGELOG --- CHANGELOG.md | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1816fd14..6c9e4f4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,11 +7,23 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## 0.3.1 - 2021-10-23 -- [[#262]] Align case trasforms across derive macros -- [[#267]] Added `is_null` and `is_not_null` to `ColumnTrait` +### Fixed Issues +* Align case trasforms across derive macros https://github.com/SeaQL/sea-orm/issues/262 +* Added `is_null` and `is_not_null` to `ColumnTrait` https://github.com/SeaQL/sea-orm/issues/267 -[#262]: https://github.com/SeaQL/sea-orm/issues/262 -[#267]: https://github.com/SeaQL/sea-orm/issues/267 +(The following is generated by GitHub) + +### Merged PRs +* Changed manual url parsing to use Url crate by @AngelOnFira in https://github.com/SeaQL/sea-orm/pull/253 +* Test self referencing relation by @billy1624 in https://github.com/SeaQL/sea-orm/pull/256 +* Unify case-transform using the same crate by @billy1624 in https://github.com/SeaQL/sea-orm/pull/264 +* CI cleaning by @AngelOnFira in https://github.com/SeaQL/sea-orm/pull/263 +* CI install sea-orm-cli in debug mode by @billy1624 in https://github.com/SeaQL/sea-orm/pull/265 + +### New Contributors +* @AngelOnFira made their first contribution in https://github.com/SeaQL/sea-orm/pull/253 + +**Full Changelog**: https://github.com/SeaQL/sea-orm/compare/0.3.0...0.3.1 ## 0.3.0 - 2021-10-15 From 9edea30f53fb9aee82a43aa19b07b2c9cd2b72b0 Mon Sep 17 00:00:00 2001 From: Chris Tsang Date: Sun, 24 Oct 2021 00:53:22 +0800 Subject: [PATCH 15/16] Edit --- CHANGELOG.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c9e4f4a..dbe10caf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## 0.3.1 - 2021-10-23 +(We are changing our Changelog format from now on) + ### Fixed Issues * Align case trasforms across derive macros https://github.com/SeaQL/sea-orm/issues/262 * Added `is_null` and `is_not_null` to `ColumnTrait` https://github.com/SeaQL/sea-orm/issues/267 @@ -20,9 +22,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/). * CI cleaning by @AngelOnFira in https://github.com/SeaQL/sea-orm/pull/263 * CI install sea-orm-cli in debug mode by @billy1624 in https://github.com/SeaQL/sea-orm/pull/265 -### New Contributors -* @AngelOnFira made their first contribution in https://github.com/SeaQL/sea-orm/pull/253 - **Full Changelog**: https://github.com/SeaQL/sea-orm/compare/0.3.0...0.3.1 ## 0.3.0 - 2021-10-15 From 058f6d5d2b938f69ef831474a12666b0942093da Mon Sep 17 00:00:00 2001 From: Carter Snook Date: Tue, 26 Oct 2021 04:27:53 -0500 Subject: [PATCH 16/16] chore: update to Rust Edition 2021 (#273) --- Cargo.toml | 2 +- examples/actix4_example/Cargo.toml | 2 +- examples/actix_example/Cargo.toml | 2 +- examples/basic/Cargo.toml | 4 ++-- examples/rocket_example/Cargo.toml | 2 +- issues/249/app/Cargo.toml | 2 +- issues/249/core/Cargo.toml | 4 ++-- issues/262/Cargo.toml | 2 +- issues/86/Cargo.toml | 2 +- sea-orm-cli/Cargo.toml | 2 +- sea-orm-codegen/Cargo.toml | 2 +- sea-orm-macros/Cargo.toml | 2 +- sea-orm-rocket/codegen/Cargo.toml | 2 +- sea-orm-rocket/lib/Cargo.toml | 2 +- 14 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 9bda93ee..4244c305 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ members = [".", "sea-orm-macros", "sea-orm-codegen"] name = "sea-orm" version = "0.3.1" authors = ["Chris Tsang "] -edition = "2018" +edition = "2021" description = "🐚 An async & dynamic ORM for Rust" license = "MIT OR Apache-2.0" documentation = "https://docs.rs/sea-orm" diff --git a/examples/actix4_example/Cargo.toml b/examples/actix4_example/Cargo.toml index 6a4e1248..4f77ead2 100644 --- a/examples/actix4_example/Cargo.toml +++ b/examples/actix4_example/Cargo.toml @@ -2,7 +2,7 @@ name = "sea-orm-actix-4-beta-example" version = "0.1.0" authors = ["Sam Samai "] -edition = "2018" +edition = "2021" publish = false [workspace] diff --git a/examples/actix_example/Cargo.toml b/examples/actix_example/Cargo.toml index 964c3a41..46a7e094 100644 --- a/examples/actix_example/Cargo.toml +++ b/examples/actix_example/Cargo.toml @@ -2,7 +2,7 @@ name = "sea-orm-actix-example" version = "0.1.0" authors = ["Sam Samai "] -edition = "2018" +edition = "2021" publish = false [workspace] diff --git a/examples/basic/Cargo.toml b/examples/basic/Cargo.toml index c2be9d88..bd9f0a08 100644 --- a/examples/basic/Cargo.toml +++ b/examples/basic/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "sea-orm-example-async-std" version = "0.1.0" -edition = "2018" +edition = "2021" publish = false [dependencies] @@ -13,4 +13,4 @@ sea-orm = { path = "../../", features = [ "sqlx-all", "runtime-async-std-native- serde_json = { version = "^1" } futures = { version = "^0.3" } async-stream = { version = "^0.3" } -futures-util = { version = "^0.3" } \ No newline at end of file +futures-util = { version = "^0.3" } diff --git a/examples/rocket_example/Cargo.toml b/examples/rocket_example/Cargo.toml index e2af4d53..044b06d8 100644 --- a/examples/rocket_example/Cargo.toml +++ b/examples/rocket_example/Cargo.toml @@ -2,7 +2,7 @@ name = "sea-orm-rocket-example" version = "0.1.0" authors = ["Sam Samai "] -edition = "2018" +edition = "2021" publish = false [workspace] diff --git a/issues/249/app/Cargo.toml b/issues/249/app/Cargo.toml index 258b37c9..74f2b990 100644 --- a/issues/249/app/Cargo.toml +++ b/issues/249/app/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "sea-orm-issues-249-app" version = "0.1.0" -edition = "2018" +edition = "2021" publish = false [dependencies] diff --git a/issues/249/core/Cargo.toml b/issues/249/core/Cargo.toml index c9b1621d..0b741c9c 100644 --- a/issues/249/core/Cargo.toml +++ b/issues/249/core/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "core" version = "0.1.0" -edition = "2018" +edition = "2021" publish = false [dependencies] sea-orm = { path = "../../../", default-features = false } [dev-dependencies] -sea-orm = { path = "../../../", features = ["mock"] } \ No newline at end of file +sea-orm = { path = "../../../", features = ["mock"] } diff --git a/issues/262/Cargo.toml b/issues/262/Cargo.toml index ad34d61c..f6fad508 100644 --- a/issues/262/Cargo.toml +++ b/issues/262/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "sea-orm-issues-262" version = "0.1.0" -edition = "2018" +edition = "2021" publish = false [dependencies] diff --git a/issues/86/Cargo.toml b/issues/86/Cargo.toml index e6d14ddb..4284cb68 100644 --- a/issues/86/Cargo.toml +++ b/issues/86/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "sea-orm-issues-86" version = "0.1.0" -edition = "2018" +edition = "2021" publish = false [dependencies] diff --git a/sea-orm-cli/Cargo.toml b/sea-orm-cli/Cargo.toml index 48e9d292..73ac202d 100644 --- a/sea-orm-cli/Cargo.toml +++ b/sea-orm-cli/Cargo.toml @@ -5,7 +5,7 @@ name = "sea-orm-cli" version = "0.3.1" authors = [ "Billy Chan " ] -edition = "2018" +edition = "2021" description = "Command line utility for SeaORM" license = "MIT OR Apache-2.0" documentation = "https://docs.rs/sea-orm" diff --git a/sea-orm-codegen/Cargo.toml b/sea-orm-codegen/Cargo.toml index d062f1bc..acd366e7 100644 --- a/sea-orm-codegen/Cargo.toml +++ b/sea-orm-codegen/Cargo.toml @@ -2,7 +2,7 @@ name = "sea-orm-codegen" version = "0.3.1" authors = ["Billy Chan "] -edition = "2018" +edition = "2021" description = "Code Generator for SeaORM" license = "MIT OR Apache-2.0" documentation = "https://docs.rs/sea-orm" diff --git a/sea-orm-macros/Cargo.toml b/sea-orm-macros/Cargo.toml index a3c52412..453c1441 100644 --- a/sea-orm-macros/Cargo.toml +++ b/sea-orm-macros/Cargo.toml @@ -2,7 +2,7 @@ name = "sea-orm-macros" version = "0.3.1" authors = [ "Billy Chan " ] -edition = "2018" +edition = "2021" description = "Derive macros for SeaORM" license = "MIT OR Apache-2.0" documentation = "https://docs.rs/sea-orm" diff --git a/sea-orm-rocket/codegen/Cargo.toml b/sea-orm-rocket/codegen/Cargo.toml index 75656487..5ab21dcc 100644 --- a/sea-orm-rocket/codegen/Cargo.toml +++ b/sea-orm-rocket/codegen/Cargo.toml @@ -7,7 +7,7 @@ repository = "https://github.com/SergioBenitez/Rocket/contrib/db_pools" readme = "../README.md" keywords = ["rocket", "framework", "database", "pools"] license = "MIT OR Apache-2.0" -edition = "2018" +edition = "2021" [lib] proc-macro = true diff --git a/sea-orm-rocket/lib/Cargo.toml b/sea-orm-rocket/lib/Cargo.toml index 3a586fe1..f4ad1adf 100644 --- a/sea-orm-rocket/lib/Cargo.toml +++ b/sea-orm-rocket/lib/Cargo.toml @@ -7,7 +7,7 @@ repository = "https://github.com/SeaQL/sea-orm" readme = "../README.md" keywords = ["rocket", "framework", "database", "pools"] license = "MIT OR Apache-2.0" -edition = "2018" +edition = "2021" [package.metadata.docs.rs] all-features = true