how to compare/validate sql schema

后端 未结 11 696
后悔当初
后悔当初 2021-02-02 16:02

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

11条回答
  •  长发绾君心
    2021-02-02 16:25

    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.

提交回复
热议问题