Skip to content

[ci-skip][Docs]Add description for db:prepare command - #49480

Merged
eileencodes merged 1 commit into
rails:mainfrom
hachi8833:add_doc_db_prepare
Oct 4, 2023
Merged

eileencodes merged 1 commit into
rails:mainfrom
hachi8833:add_doc_db_prepare

Conversation

@hachi8833

Copy link
Copy Markdown
Contributor

Motivation / Background

This Pull Request has been created because bin/rails db:prepare is missing in current migration guide since Rails 6.0.

cc: @bensheldon, the author of #45464

Detail

This Pull Request add a description for db:prepare.

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one change. Changes that are unrelated should be opened in separate PRs.
  • Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex: [Fix #issue-number]

@rails-bot rails-bot Bot added the docs label Oct 4, 2023

@bensheldon bensheldon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for updating this! I suggested one small tweak.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* If the database exists but the tables have not been created, the command will load the schema, run any pending migrations to dump schema, and finally load the seed data.
* If the database exists but the tables have not been created, the command will load the schema, run any pending migrations, dump the updated schema, and finally load the seed data.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the review! Updated.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Squashed the commits.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. Can you wrap the docs to 80 characters like the rest of the document?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added hard wrap and squashed.

Review by ChatGPT

Minor fix on db:prepare document

Update by review

Add hard wrap
@eileencodes
eileencodes merged commit bced1e1 into rails:main Oct 4, 2023
@hachi8833
hachi8833 deleted the add_doc_db_prepare branch October 4, 2023 11:06
rafaelfranca pushed a commit that referenced this pull request Oct 4, 2023
[ci-skip][Docs]Add description for `db:prepare` command
flavorjones added a commit to flavorjones/rails that referenced this pull request Oct 19, 2024
Introduces a new database config property `seeds` to control whether
seeds are loaded during `db:prepare` which defaults to `true` for
primary database configs and `false otherwise.

Previously, the `db:prepare` task would load seeds whenever a new
database is created, leading to potential loss of data if a database
is added to an existing environment.

Also, update the Active Record Migrations guide to more accurately
describe what the `db:prepare` task does, correcting some
misinformation introduced in rails#49480 along the way.

Closes rails#53348
flavorjones added a commit to flavorjones/rails that referenced this pull request Oct 19, 2024
Introduces a new database config property `seeds` to control whether
seeds are loaded during `db:prepare` which defaults to `true` for
primary database configs and `false otherwise.

Previously, the `db:prepare` task would load seeds whenever a new
database is created, leading to potential loss of data if a database
is added to an existing environment.

Also, update the Active Record Migrations guide to more accurately
describe what the `db:prepare` task does, correcting some
misinformation introduced in rails#49480 along the way.

Closes rails#53348
flavorjones added a commit to flavorjones/rails that referenced this pull request Oct 19, 2024
Introduces a new database config property `seeds` to control whether
seeds are loaded during `db:prepare` which defaults to `true` for
primary database configs and `false otherwise.

Previously, the `db:prepare` task would load seeds whenever a new
database is created, leading to potential loss of data if a database
is added to an existing environment.

Also, update the Active Record Migrations guide to more accurately
describe what the `db:prepare` task does, correcting some
misinformation introduced in rails#49480 along the way.

Closes rails#53348
flavorjones added a commit to flavorjones/rails that referenced this pull request Oct 24, 2024
Introduces a new database config property `seeds` to control whether
seeds are loaded during `db:prepare` which defaults to `true` for
primary database configs and `false otherwise.

Previously, the `db:prepare` task would load seeds whenever a new
database is created, leading to potential loss of data if a database
is added to an existing environment.

Also, update the Active Record Migrations guide to more accurately
describe what the `db:prepare` task does, correcting some
misinformation introduced in rails#49480 along the way.

Closes rails#53348
rafaelfranca pushed a commit to flavorjones/rails that referenced this pull request Oct 25, 2024
Introduces a new database config property `seeds` to control whether
seeds are loaded during `db:prepare` which defaults to `true` for
primary database configs and `false otherwise.

Previously, the `db:prepare` task would load seeds whenever a new
database is created, leading to potential loss of data if a database
is added to an existing environment.

Also, update the Active Record Migrations guide to more accurately
describe what the `db:prepare` task does, correcting some
misinformation introduced in rails#49480 along the way.

Closes rails#53348
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants