{ "info": { "author": "Andrew Beveridge", "author_email": "andrew@beveridge.uk", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "SQL Migration Runner\n======================\n\n[//]: # (Latest PyPi Release)\n[//]: # (Supported Python Versions)\n[//]: # (Build Status)\n[//]: # (Documentation Status)\n[//]: # (Code Coverage)\n[//]: # (Has Wheel Package)\n[//]: # (Updates)\n\n[![](https://img.shields.io/pypi/v/migration_runner.svg)](https://pypi.python.org/pypi/migration_runner)\n[![](https://img.shields.io/pypi/pyversions/migration_runner.svg?style=flat)](https://pypi.python.org/pypi/migration_runner)\n[![](https://img.shields.io/travis/beveradb/migration_runner.svg)](https://travis-ci.org/beveradb/migration_runner)\n[![](https://readthedocs.org/projects/migration_runner/badge/?version=latest)](https://migration_runner.readthedocs.io/en/latest/?badge=latest)\n[![](https://coveralls.io/repos/github/beveradb/migration_runner/badge.svg?branch=master)](https://coveralls.io/github/beveradb/migration_runner?branch=master)\n[![](https://img.shields.io/pypi/wheel/migration_runner.svg)](https://pypi.org/project/migration_runner/#files)\n[![](https://pyup.io/repos/github/beveradb/migration_runner/shield.svg)](https://pyup.io/repos/github/beveradb/migration_runner/)\n\nPython script to run SQL migration scripts sequentially from the specified folder,\nupdating latest schema version in the database itself after each migration.\n\n**WARNING**: this tool was created purely as a solution for the ECS Digital technical test.\nSee [PROBLEM](https://github.com/beveradb/migration_runner/blob/master/docs/PROBLEM.md) \nfor details of the use case and requirements for the task.\n\nIt almost certainly should **not** be used for any real-world use case, as mature solutions\nexist for almost every use case. See \"Problem Overview\" section of [NOTES](https://github.com/beveradb/migration_runner/blob/master/docs/NOTES.md) \nfor further commentary on this topic. \n\n------------------------\n\n## Requirements\n\n* Python 2.7, or 3.5+\n* Existing MySQL or MariaDB database, either running locally or on a remote host.\n* Table called `versionTable`, with a single `int(11)` column named \"version\". See [here](https://github.com/beveradb/migration_runner/blob/master/sql-migrations/001.create_migrations_version_table.sql) for schema.\n* Directory containing SQL scripts to execute to migrate the database to each version.\n * Each migration / version should have one file.\n * Files should be named to match the pattern `VERSION.brief_description.sql`,\n where VERSION is an integer representing the database version after executing that script.\n* Version numbers should be unique and sequential for consistent results.\n\n## Installation\n\nTo install Migration Runner, run this command in your terminal:\n\n``` console\n$ pip install migration_runner\n```\n\nThis is the preferred method to install Migration Runner, as it will\nalways install the most recent stable release.\n\nIf you don't have [pip](https://pip.pypa.io) installed, this [Python\ninstallation\nguide](http://docs.python-guide.org/en/latest/starting/installation/)\ncan guide you through the process.\n\nFor instructions on building from source, see the \n[documentation](https://migration_runner.readthedocs.io).\n\n## Usage\n\nRun the `migration_runner` script with `--help` to get usage instructions:\n\n```\n$ migration_runner --help\n\nUsage: migration_runner [OPTIONS] SQL_DIRECTORY DB_USER DB_HOST DB_NAME DB_PASSWORD\n\n A cli tool for executing SQL migrations in sequence.\n\nOptions:\n -s, --single-file TEXT Filename of single SQL script to process.\n -l, --loglevel LVL Either CRITICAL, ERROR, WARNING, INFO or DEBUG\n -v, --version Show the version and exit.\n --help Show this message and exit.\n```\n\n## Examples\n\n#### Successful usage:\n```\n$ migration_runner sql-migrations beveradb migration_runner_test.beveradb.tk test_user test_password\n\n2019-02-10 22:16:30,394 - info: Starting with database version: 0\n2019-02-10 22:16:30,395 - info: Migrations yet to be processed: 10 (out of 11 in dir)\n2019-02-10 22:16:30,721 - info: Successfully upgraded database from version: 0 to 1 by executing migration in file: 'sql-migrations/001.create_migrations_version_table.sql'\n2019-02-10 22:16:31,566 - info: Successfully upgraded database from version: 1 to 2 by executing migration in file: 'sql-migrations/2.set_current_version_to_1.sql'\n2019-02-10 22:16:32,562 - info: Successfully upgraded database from version: 2 to 45 by executing migration in file: 'sql-migrations/045.createtable.sql'\n2019-02-10 22:16:33,236 - info: Successfully upgraded database from version: 45 to 46 by executing migration in file: 'sql-migrations/046.create_seed_items.sql'\n2019-02-10 22:16:34,173 - info: Successfully upgraded database from version: 46 to 48 by executing migration in file: 'sql-migrations/048.create_rooms.sql'\n2019-02-10 22:16:34,849 - info: Successfully upgraded database from version: 48 to 49 by executing migration in file: 'sql-migrations/049 .rename-object-item.sql'\n2019-02-10 22:16:36,258 - info: Successfully upgraded database from version: 49 to 51 by executing migration in file: 'sql-migrations/051-add-room-relations.sql'\n2019-02-10 22:16:37,165 - info: Successfully upgraded database from version: 51 to 52 by executing migration in file: 'sql-migrations/052.create_customer_order.sql'\n2019-02-10 22:16:38,299 - info: Successfully upgraded database from version: 52 to 54 by executing migration in file: 'sql-migrations/54-fix-customer-address-defaults.sql'\n2019-02-10 22:16:39,150 - info: Successfully upgraded database from version: 54 to 55 by executing migration in file: 'sql-migrations/55exampleorder.sql'\n2019-02-10 22:16:39,499 - info: Database version now 55 after processing 10 migrations. Remaining: 0.\n```\n\n#### Nothing to process:\n```\n$ migration_runner sql-migrations test_user beveradb.tk migration_runner_test test_password\n\n2019-02-10 22:19:23,252 - info: Starting with database version: 55\n2019-02-10 22:19:23,252 - info: Migrations yet to be processed: 0 (out of 11 in dir)\n2019-02-10 22:19:23,252 - info: Database version now 55 after processing 0 migrations. Remaining: 0.\n```\n\n#### Missing argument:\n```\n$ migration_runner sql-migrations test_user beveradb.tk migration_runner_test\n\nUsage: migration_runner [OPTIONS] SQL_DIRECTORY DB_USER DB_HOST DB_NAME\n DB_PASSWORD\nTry \"migration_runner --help\" for help.\n\nError: Missing argument \"DB_PASSWORD\".\n```\n\n#### Debug output:\n```\n$ migration_runner -l DEBUG sql-migrations test_user beveradb.tk migration_runner_test fake_password\n\n2019-02-10 22:21:48,074 - debug: CLI execution start\n2019-02-10 22:21:48,075 - debug: Migrations found: 11\n2019-02-10 22:21:48,075 - debug: Connecting to database with details: user=test_user, password=fake_password, host=beveradb.tk, db=migration_runner_test\n2019-02-10 22:20:37,731 - error: Database connection error: 1045 (28000): Access denied for user 'test_user' (using password: YES)\n```\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/beveradb/migration_runner", "keywords": "migration_runner", "license": "MIT license", "maintainer": "", "maintainer_email": "", "name": "migration-runner", "package_url": "https://pypi.org/project/migration-runner/", "platform": "", "project_url": "https://pypi.org/project/migration-runner/", "project_urls": { "Homepage": "https://github.com/beveradb/migration_runner" }, "release_url": "https://pypi.org/project/migration-runner/0.3.4/", "requires_dist": [ "Click (>=7.0)", "click-log (>=0.3.2)" ], "requires_python": "", "summary": "Run MySQL migration scripts sequentially from a specified directory, keeping track of current version in the database.", "version": "0.3.4" }, "last_serial": 4812142, "releases": { "0.3.0": [ { "comment_text": "", "digests": { "md5": "b2ab2a653f9f94b7a2b071c409889192", "sha256": "38f17a0c8cc4799079ba9c2f9e816848f68c636dd01a644129f2e10296499c7f" }, "downloads": -1, "filename": "migration_runner-0.3.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "b2ab2a653f9f94b7a2b071c409889192", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7236, "upload_time": "2019-02-12T05:45:22", "url": "https://files.pythonhosted.org/packages/ad/44/0a17512e364fc2670e9fb59e2629916c2cefd3401c03f11f6e12c2fcff00/migration_runner-0.3.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "285dd16cd8d67c5e34c698a15acec6a0", "sha256": "a1acfd6e4fc251b468c476306cc9b38e9471f1265d31bfb6f2654c17ec52ca79" }, "downloads": -1, "filename": "migration_runner-0.3.0.tar.gz", "has_sig": false, "md5_digest": "285dd16cd8d67c5e34c698a15acec6a0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19618, "upload_time": "2019-02-12T05:45:24", "url": "https://files.pythonhosted.org/packages/5c/f2/2133efd2cd8e55bde79366b732492cb489727215ad208b8b115ca1729c02/migration_runner-0.3.0.tar.gz" } ], "0.3.2": [ { "comment_text": "", "digests": { "md5": "e76478c94493675596b03ca3da899ecc", "sha256": "30c3ab32ddc02df0229e2af2490c022018be98ef02905487ae709ef48f7829c7" }, "downloads": -1, "filename": "migration_runner-0.3.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "e76478c94493675596b03ca3da899ecc", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9058, "upload_time": "2019-02-12T15:14:52", "url": "https://files.pythonhosted.org/packages/08/1a/cc1c03ac16420dd630df16239c1ed4b6a99806b0665c41b0457c539d08c6/migration_runner-0.3.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a20ba012a2230db4f23aa2091077e0d0", "sha256": "9ce41713b1fb52840d67f741058399d56fdf0fd994d2890ef9c10da5221cc16d" }, "downloads": -1, "filename": "migration_runner-0.3.2.tar.gz", "has_sig": false, "md5_digest": "a20ba012a2230db4f23aa2091077e0d0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18858, "upload_time": "2019-02-12T15:14:53", "url": "https://files.pythonhosted.org/packages/ac/d9/1d80ebe4dd994b643122bf15c68dbde7a9429cfabef0eda3bf19c8ad3152/migration_runner-0.3.2.tar.gz" } ], "0.3.4": [ { "comment_text": "", "digests": { "md5": "711f4dfb5726a3970f8be25b9ec9868f", "sha256": "40f65ecf43caebad8111a45098ce464fccdcb551a6528f850a7e7d6997216493" }, "downloads": -1, "filename": "migration_runner-0.3.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "711f4dfb5726a3970f8be25b9ec9868f", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9040, "upload_time": "2019-02-12T18:01:38", "url": "https://files.pythonhosted.org/packages/75/9b/7a0b5932a70149d75cd1397c1adddf1f7bfe1bf4c58554126087826365a8/migration_runner-0.3.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "07cc9194271e1069b309796d6cc86e3c", "sha256": "6751afaa0efffcbf7b44320e1b055e4ca3250f3b77798f393a68880b973acb97" }, "downloads": -1, "filename": "migration_runner-0.3.4.tar.gz", "has_sig": false, "md5_digest": "07cc9194271e1069b309796d6cc86e3c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15819, "upload_time": "2019-02-12T18:01:39", "url": "https://files.pythonhosted.org/packages/8f/6a/0aa7dd210091476e2d12176e0d881bf37abde629dea7b3fc5a9684e3dc3e/migration_runner-0.3.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "711f4dfb5726a3970f8be25b9ec9868f", "sha256": "40f65ecf43caebad8111a45098ce464fccdcb551a6528f850a7e7d6997216493" }, "downloads": -1, "filename": "migration_runner-0.3.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "711f4dfb5726a3970f8be25b9ec9868f", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9040, "upload_time": "2019-02-12T18:01:38", "url": "https://files.pythonhosted.org/packages/75/9b/7a0b5932a70149d75cd1397c1adddf1f7bfe1bf4c58554126087826365a8/migration_runner-0.3.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "07cc9194271e1069b309796d6cc86e3c", "sha256": "6751afaa0efffcbf7b44320e1b055e4ca3250f3b77798f393a68880b973acb97" }, "downloads": -1, "filename": "migration_runner-0.3.4.tar.gz", "has_sig": false, "md5_digest": "07cc9194271e1069b309796d6cc86e3c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15819, "upload_time": "2019-02-12T18:01:39", "url": "https://files.pythonhosted.org/packages/8f/6a/0aa7dd210091476e2d12176e0d881bf37abde629dea7b3fc5a9684e3dc3e/migration_runner-0.3.4.tar.gz" } ] }