Skip to content

Commit

Permalink
docs: clarify data fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jondot committed Aug 7, 2024
1 parent 4c61113 commit 77f3a9a
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions docs-site/content/docs/the-app/models.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,24 +267,25 @@ You can copy some of this code for adding an index
### Create a data fix


Creating a data fix in a migration is easy - just `use` your models as you would otherwise:
Creating a data fix in a migration is easy - just use SQL statements as you like:

```rust
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {

let db = manager.get_connection();

// issue SQL queries with `db`
// https://www.sea-ql.org/SeaORM/docs/basic-crud/raw-sql/#use-raw-query--execute-interface

cake::ActiveModel {
name: Set("Cheesecake".to_owned()),
..Default::default()
}
.insert(db)
.await?;
Ok(())
}
```

Having said that, it's up to you to code your data fixes in a `task` or `migration` or an ad-hoc `playground`.
Having said that, it's up to you to code your data fixes in:

* `task` - where you can use high level models
* `migration` - where you can both change structure and fix data stemming from it with raw SQL
* or an ad-hoc `playground` - where you can use high level models or experiment with things


## Validation
Expand Down

0 comments on commit 77f3a9a

Please sign in to comment.