Replaces SETUP_COMPLETED variable with a database setting. Changes setup to add the setting to the database. Also adds a migration for existing installations.