Fix #959: SQLite -> PostgreSQL migration