refactor sqlite with cascade and foreign keys

Removing an account now removes the images entry so they don't keep
building up and causing issues.

Thanks @JustinAzoff