diff --git a/docs-site/content/docs/getting-started/guide.md b/docs-site/content/docs/getting-started/guide.md index 2c999df7b..d646f11d7 100644 --- a/docs-site/content/docs/getting-started/guide.md +++ b/docs-site/content/docs/getting-started/guide.md @@ -369,9 +369,9 @@ impl MigrationTrait for Migration { manager .create_table( table_auto(Articles::Table) - .col(pk_auto(Articles::Id).borrow_mut()) - .col(string_null(Articles::Title).borrow_mut()) - .col(text(Articles::Content).borrow_mut()) + .col(pk_auto(Articles::Id)) + .col(string_null(Articles::Title)) + .col(text(Articles::Content)) .to_owned(), ) .await @@ -649,7 +649,7 @@ If you peek into the new migration, you'll discover a new database relation in t ```rust .. .. - .col(integer(Comments::ArticleId).borrow_mut()) + .col(integer(Comments::ArticleId)) .foreign_key( ForeignKey::create() .name("fk-comments-articles") diff --git a/docs-site/content/docs/the-app/migration.md b/docs-site/content/docs/the-app/migration.md index 6fb2de193..2b282fc68 100644 --- a/docs-site/content/docs/the-app/migration.md +++ b/docs-site/content/docs/the-app/migration.md @@ -83,7 +83,7 @@ Adding a column: .alter_table( Table::alter() .table(Movies::Table) - .add_column_if_not_exists(integer(Movies::Rating).borrow_mut()) + .add_column_if_not_exists(integer(Movies::Rating)) .to_owned(), ) .await diff --git a/examples/demo/migration/src/m20220101_000001_users.rs b/examples/demo/migration/src/m20220101_000001_users.rs index da8a59426..5e1d99247 100644 --- a/examples/demo/migration/src/m20220101_000001_users.rs +++ b/examples/demo/migration/src/m20220101_000001_users.rs @@ -10,17 +10,17 @@ pub struct Migration; impl MigrationTrait for Migration { async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> { let table = table_auto(Users::Table) - .col(pk_auto(Users::Id).borrow_mut()) - .col(uuid(Users::Pid).borrow_mut()) - .col(string_uniq(Users::Email).borrow_mut()) - .col(string(Users::Password).borrow_mut()) - .col(string(Users::ApiKey).borrow_mut().unique_key()) - .col(string(Users::Name).borrow_mut()) - .col(string_null(Users::ResetToken).borrow_mut()) - .col(timestamp_null(Users::ResetSentAt).borrow_mut()) - .col(string_null(Users::EmailVerificationToken).borrow_mut()) - .col(timestamp_null(Users::EmailVerificationSentAt).borrow_mut()) - .col(timestamp_null(Users::EmailVerifiedAt).borrow_mut()) + .col(pk_auto(Users::Id)) + .col(uuid(Users::Pid)) + .col(string_uniq(Users::Email)) + .col(string(Users::Password)) + .col(string(Users::ApiKey).unique_key()) + .col(string(Users::Name)) + .col(string_null(Users::ResetToken)) + .col(timestamp_null(Users::ResetSentAt)) + .col(string_null(Users::EmailVerificationToken)) + .col(timestamp_null(Users::EmailVerificationSentAt)) + .col(timestamp_null(Users::EmailVerifiedAt)) .to_owned(); manager.create_table(table).await?; Ok(()) diff --git a/examples/demo/migration/src/m20231103_114510_notes.rs b/examples/demo/migration/src/m20231103_114510_notes.rs index 8e8984628..6e4d44918 100644 --- a/examples/demo/migration/src/m20231103_114510_notes.rs +++ b/examples/demo/migration/src/m20231103_114510_notes.rs @@ -12,9 +12,9 @@ impl MigrationTrait for Migration { manager .create_table( table_auto(Notes::Table) - .col(pk_auto(Notes::Id).borrow_mut()) - .col(string_null(Notes::Title).borrow_mut()) - .col(string_null(Notes::Content).borrow_mut()) + .col(pk_auto(Notes::Id)) + .col(string_null(Notes::Title)) + .col(string_null(Notes::Content)) .to_owned(), ) .await diff --git a/src/gen/templates/migration.t b/src/gen/templates/migration.t index 100269c90..c70905cc9 100644 --- a/src/gen/templates/migration.t +++ b/src/gen/templates/migration.t @@ -37,7 +37,7 @@ impl MigrationTrait for Migration { .alter_table( Table::alter() .table(Movies::Table) - .add_column_if_not_exists(integer(Movies::Rating).borrow_mut()) + .add_column_if_not_exists(integer(Movies::Rating)) .to_owned(), ) .await diff --git a/src/gen/templates/model.t b/src/gen/templates/model.t index 1690ef463..c9603933e 100644 --- a/src/gen/templates/model.t +++ b/src/gen/templates/model.t @@ -35,13 +35,13 @@ impl MigrationTrait for Migration { {% for ref in references -%} .col({{model}}::{{ref.1 | pascal_case}}) {% endfor -%} - .borrow_mut(), + , ) {% else -%} - .col(pk_auto({{model}}::Id).borrow_mut()) + .col(pk_auto({{model}}::Id)) {% endif -%} {% for column in columns -%} - .col({{column.1}}({{model}}::{{column.0 | pascal_case}}).borrow_mut()) + .col({{column.1}}({{model}}::{{column.0 | pascal_case}})) {% endfor -%} {% for ref in references -%} .foreign_key( diff --git a/src/schema.rs b/src/schema.rs index b8ee6fb10..ee9f1205d 100644 --- a/src/schema.rs +++ b/src/schema.rs @@ -20,13 +20,13 @@ //! impl MigrationTrait for Migration { //! async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> { //! let table = table_auto(Users::Table) -//! .col(pk_auto(Users::Id).borrow_mut()) -//! .col(uuid(Users::Pid).borrow_mut()) -//! .col(string_uniq(Users::Email).borrow_mut()) -//! .col(string(Users::Password).borrow_mut()) -//! .col(string(Users::Name).borrow_mut()) -//! .col(string_null(Users::ResetToken).borrow_mut()) -//! .col(timestamp_null(Users::ResetSentAt).borrow_mut()) +//! .col(pk_auto(Users::Id)) +//! .col(uuid(Users::Pid)) +//! .col(string_uniq(Users::Email)) +//! .col(string(Users::Password)) +//! .col(string(Users::Name)) +//! .col(string_null(Users::ResetToken)) +//! .col(timestamp_null(Users::ResetSentAt)) //! .to_owned(); //! manager.create_table(table).await?; //! Ok(()) diff --git a/starters/rest-api/migration/src/m20220101_000001_users.rs b/starters/rest-api/migration/src/m20220101_000001_users.rs index 0feaab54e..546d9ed02 100644 --- a/starters/rest-api/migration/src/m20220101_000001_users.rs +++ b/starters/rest-api/migration/src/m20220101_000001_users.rs @@ -10,17 +10,17 @@ pub struct Migration; impl MigrationTrait for Migration { async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> { let table = table_auto(Users::Table) - .col(pk_auto(Users::Id).borrow_mut()) - .col(uuid(Users::Pid).borrow_mut()) - .col(string_uniq(Users::Email).borrow_mut()) - .col(string(Users::Password).borrow_mut()) - .col(string(Users::ApiKey).borrow_mut().unique_key()) - .col(string(Users::Name).borrow_mut()) - .col(string_null(Users::ResetToken).borrow_mut()) - .col(timestamp_null(Users::ResetSentAt).borrow_mut()) - .col(string_null(Users::EmailVerificationToken).borrow_mut()) - .col(timestamp_null(Users::EmailVerificationSentAt).borrow_mut()) - .col(timestamp_null(Users::EmailVerifiedAt).borrow_mut()) + .col(pk_auto(Users::Id)) + .col(uuid(Users::Pid)) + .col(string_uniq(Users::Email)) + .col(string(Users::Password)) + .col(string(Users::ApiKey).unique_key()) + .col(string(Users::Name)) + .col(string_null(Users::ResetToken)) + .col(timestamp_null(Users::ResetSentAt)) + .col(string_null(Users::EmailVerificationToken)) + .col(timestamp_null(Users::EmailVerificationSentAt)) + .col(timestamp_null(Users::EmailVerifiedAt)) .to_owned(); manager.create_table(table).await?; Ok(()) diff --git a/starters/rest-api/migration/src/m20231103_114510_notes.rs b/starters/rest-api/migration/src/m20231103_114510_notes.rs index 8e8984628..6e4d44918 100644 --- a/starters/rest-api/migration/src/m20231103_114510_notes.rs +++ b/starters/rest-api/migration/src/m20231103_114510_notes.rs @@ -12,9 +12,9 @@ impl MigrationTrait for Migration { manager .create_table( table_auto(Notes::Table) - .col(pk_auto(Notes::Id).borrow_mut()) - .col(string_null(Notes::Title).borrow_mut()) - .col(string_null(Notes::Content).borrow_mut()) + .col(pk_auto(Notes::Id)) + .col(string_null(Notes::Title)) + .col(string_null(Notes::Content)) .to_owned(), ) .await diff --git a/starters/saas/migration/src/m20220101_000001_users.rs b/starters/saas/migration/src/m20220101_000001_users.rs index 0feaab54e..546d9ed02 100644 --- a/starters/saas/migration/src/m20220101_000001_users.rs +++ b/starters/saas/migration/src/m20220101_000001_users.rs @@ -10,17 +10,17 @@ pub struct Migration; impl MigrationTrait for Migration { async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> { let table = table_auto(Users::Table) - .col(pk_auto(Users::Id).borrow_mut()) - .col(uuid(Users::Pid).borrow_mut()) - .col(string_uniq(Users::Email).borrow_mut()) - .col(string(Users::Password).borrow_mut()) - .col(string(Users::ApiKey).borrow_mut().unique_key()) - .col(string(Users::Name).borrow_mut()) - .col(string_null(Users::ResetToken).borrow_mut()) - .col(timestamp_null(Users::ResetSentAt).borrow_mut()) - .col(string_null(Users::EmailVerificationToken).borrow_mut()) - .col(timestamp_null(Users::EmailVerificationSentAt).borrow_mut()) - .col(timestamp_null(Users::EmailVerifiedAt).borrow_mut()) + .col(pk_auto(Users::Id)) + .col(uuid(Users::Pid)) + .col(string_uniq(Users::Email)) + .col(string(Users::Password)) + .col(string(Users::ApiKey).unique_key()) + .col(string(Users::Name)) + .col(string_null(Users::ResetToken)) + .col(timestamp_null(Users::ResetSentAt)) + .col(string_null(Users::EmailVerificationToken)) + .col(timestamp_null(Users::EmailVerificationSentAt)) + .col(timestamp_null(Users::EmailVerifiedAt)) .to_owned(); manager.create_table(table).await?; Ok(()) diff --git a/starters/saas/migration/src/m20231103_114510_notes.rs b/starters/saas/migration/src/m20231103_114510_notes.rs index 8e8984628..6e4d44918 100644 --- a/starters/saas/migration/src/m20231103_114510_notes.rs +++ b/starters/saas/migration/src/m20231103_114510_notes.rs @@ -12,9 +12,9 @@ impl MigrationTrait for Migration { manager .create_table( table_auto(Notes::Table) - .col(pk_auto(Notes::Id).borrow_mut()) - .col(string_null(Notes::Title).borrow_mut()) - .col(string_null(Notes::Content).borrow_mut()) + .col(pk_auto(Notes::Id)) + .col(string_null(Notes::Title)) + .col(string_null(Notes::Content)) .to_owned(), ) .await