· Must be in a bash script
· You will have to use a MySQL 5.7 database
A database upgrade requires the execution of numbered SQL scripts stored in a specified folder, named such as '[login to view URL]'
- The scripts may contain any simple SQL statement(s) to any table of your choice, e.g. 'INSERT INTO testTable VALUES("[login to view URL]");'
· There may be gaps in the SQL file name numbering and there isn't always a . (dot) after the beginning number
· The database upgrade is based on looking up the current version in the database and comparing this number to the numbers in the script names
- The table where the current db version is stored is called 'versionTable', with a single row for the version, called 'version'
· If the version number from the db matches the highest number from the scripts then nothing is executed
· All scripts that contain a number higher than the current db version will be executed against the database in numerical order
· In addition, the database version table is updated after the script execution with the executed script's number
· Your script will be executed automatically via a program, and must satisfy these command line input parameters exactly in order to run:
- './your-script directory-with-sql-scripts username-for-the-db db-host db-name db-password'
You will need to satisfy all requirements with adequate tests carried out
Also create a a readme documenting steps required to run the script, document like you’re explaining it to someone who is non technical if possible