rapid7/metasploit-framework — pull request #3623 by limhoff-r7 (2014-08-07 01:01:46+00:00)
Title: Run migrations when connection already established in console

[MSP-10955](https://jira.tor.rapid7.com/secure/RapidBoard.jspa?rapidView=84&selectedIssue=MSP-10955)

`Msf::Ui::Console::Driver#initialize` doesn't call
`framework.db.connect` if it can't find the the `database.yml`, but when
using `msfpro`, the connection is already established, so the console
doesn't need to know where the database file is and should just run the
migrations so that `framework.db.migrate` can be set and
`framework.db.active` will return `true`.

# Verification Steps

## Before All
- [ ] Ensure `database.yml` from your user's config root can't be loaded: `mv ~/.msf4 ~/.msf4.bak`

## msfpro

- [ ] `cd pro/engine`
- [ ] `./msfpro --environment development`
- [ ] VERIFY `db_status`
```
[*] postgresql connected to metasploit_pro_development
```
- [ ] `irb`
- [ ] VERIFY DBManager is active `framework.db.active`
- [ ] `exit`
- [ ] VERIFY `hosts` does NOT return
```
[-] Database not connected
```
- [ ] `exit`

## After All
- [ ] Restore your user config root
```
rm -rf ~/.msf4
mv ~/.msf4.bak ~/.msf4
```