---
title: "Rails Logs: Meet the Three Rake Brothers (for When rake db Goes Wrong)"
description: "Saving yourself when rails db breaks"
author: "kidneyweakx"
published: 2019-03-11T00:00:00.000Z
updated: 2026-06-02T17:15:07.411Z
lang: en
tags: ["程式筆記", "Ruby on Rails"]
canonical: https://kidneyweakx.com/blog/19log-0311-rakedb?lang=en
alternate_zh_tw: https://kidneyweakx.com/blog/19log-0311-rakedb.md
alternate_ja: https://kidneyweakx.com/blog/19log-0311-rakedb.md?lang=ja
---

# Rails Logs: Meet the Three Rake Brothers (for When rake db Goes Wrong)

### **Saving yourself when rails db breaks**

__Run these in order, or run migrate on its own; this is the last-resort fix__

The whole procedure is pretty dangerous, so I recommend only doing it during development. The main thing is to keep your attention on the **migration**.

```ruby
rake db:drop  #刪除數據庫
rake db:create #新建數據庫
rake db:migrate #更改數據庫(有時可單獨執行)
```

<br />

Never, ever **drop the DB in production. You're dead if you do.** 

Most backend problems show up as schema migration errors. rake won't automatically call migration for the schema when the backend starts, so you have to run it yourself.
