<p>I'm looking for a way to validate the SQL schema on a production DB after updating an application version. If the application does not match the DB schema version, there should be a way to warn the user and list the changes needed.</p>

<p>Is there a tool or a framework (to use programatically) with built-in features to do that?
Or is there some simple algorithm to run this comparison?</p>

<blockquote>
  <p><strong>Update:</strong> Red gate lists "from $395". Anything free? Or more foolproof than just keeping the version number?</p>
</blockquote>

Make a table and store your version number in there. Just make sure you update it as necessary.
```
```
CREATE TABLE version (
    version VARCHAR(255) NOT NULL
)
INSERT INTO version VALUES ('v1.0');
```
```
You can then check the version number stored in the database matches the application code during your app's setup or wherever is convenient.