Skip to content

Commit 932bd4a

Browse files
Update getting_started.md
Add instructions for using the db:migrate:redo command after updating and existing migration file.
1 parent f511cd3 commit 932bd4a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

guides/source/getting_started.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1728,8 +1728,13 @@ And next, let's update the database with the generated migrations:
17281728
$ bin/rails db:migrate
17291729
```
17301730

1731-
To choose the status for the existing articles and comments you can add a default value to the generated migration files by adding the `default: "public"` option and launch the migrations again. You can also call in a rails console `Article.update_all(status: "public")` and `Comment.update_all(status: "public")`.
1731+
To choose the status for the existing articles and comments you can add a default value to the generated migration files by adding the `default: "public"` option. Once you have made a change to the migration file you can re-run that last step again:
17321732

1733+
```bash
1734+
$ bin/rails db:migrate:redo
1735+
```
1736+
1737+
You can also call in a rails console `Article.update_all(status: "public")` and `Comment.update_all(status: "public")`.
17331738

17341739
TIP: To learn more about migrations, see [Active Record Migrations](
17351740
active_record_migrations.html).

0 commit comments

Comments
 (0)