{ "info": { "author": "Sergey Kirillov", "author_email": "sergey.kirillov@gmail.com", "bugtrack_url": null, "classifiers": [ "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python" ], "description": "=======================================\nPainless DVCS-aware database migrations\n=======================================\n\nTheory\n------\n\nPGmigrate helps you to evolve your database together with your application.\n \nThe fundamental unit of PGmigrate is a single SQL snippet called `patch`.\n\nSample database patch\n^^^^^^^^^^^^^^^^^^^^^\n\n::\n\n $ cat 000049_Added_index_on_CategorySlug.sql \n --- id: 89ccfca6-6851-11e1-99d8-a088b4e3b168\n --- author: serg\n --- memo: Added index on CategorySlug\n --- date: 2012-03-07 14:32\n \n CREATE UNIQUE INDEX catalog_category_slug_shop_id_slug\n ON catalog_category_slug\n USING btree\n (shop_id, slug);\n \nAs you can see patch is a valid SQL file, which even can be executed directly. It also has nice, human readable file name, and some metadata.\n\n\nQuickstart\n----------\n\nInitialize database\n^^^^^^^^^^^^^^^^^^^\n\n::\n\n $ pgmigrate2 init postgresql://user@password/testdb\n $\n \nThis will create table `__applied_patches__` in testdb. This table is used to track which patches are already applied.\n\n\nCreate a patch repo, and a first patch\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n::\n \n $ mkdir patchrepo\n $ pgmigrate2 newpatch patchrepo\n ... edit patch in your text editor...\n Wrote 'patchrepo/000001_creating_table_x.sql'\n $\n \nThis will create empty patch and open it in your text editor. Enter patch SQL, and optional memo, describing what is the function of this patch.\n\nPGmigrate will create a file like `patchrepo/000001_creating_table_x.sql` where `000001` is a patch serial number, and `creating_table_x` is a \nslugified patch memo. PGmigrate will fill rest of patch metadata by itself.\n\n \nCheck what needs to be applied to\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n::\n\n $ pgmigrate2 check patchrepo/ postgresql://user@password/testdb\n Need to apply: creating table x\n $\n\nCheck takes all patches in patch repo, and print a list of patches which are need to be applied to testd.\n\n\nApply patches\n^^^^^^^^^^^^^\n\n::\n\n $ pgmigrate2 migrate patchrepo/ postgresql://user@password/testdb\n Need to apply 1 patches:\n Applying 'creating table x'\n $ \n\nMigrate takes all patches from patch repo, and sequentially applies those of them, whose id are not present in `__applied_patches__`\ntables of `testdb`.\n\n\nEmbedding\n---------\n\nHere is example how we use PGmigrate in our project::\n\n ### Database migration commands\n @finaloption.command(config_opts)\n def dbmigrate(config):\n from shopium.core.config import read_config\n config = read_config(config)\n from pgmigrate2 import api\n \n return api.migrate('migrations', config.db_uri)\n \n\n @finaloption.command(config_opts)\n def dbnewpatch(config):\n from shopium.core.config import read_config\n config = read_config(config)\n from pgmigrate2 import api\n \n import subprocess\n \n path = api.newpatch('migrations')\n if path:\n subprocess.check_call('hg add %s' % path, shell=True) # add created patch to Mercurial repo\n\n\n @finaloption.command(config_opts)\n def dbcheckstatus(config):\n from shopium.core.config import read_config\n config = read_config(config)\n from pgmigrate2 import api\n \n api.check_status('migrations', config.db_uri)\n\n\n\nQ&A\n---\n\nWhy it is called PGmigrate?\n^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nThat's abbreviation for PostgreSQL Migrate.\n \nIs it really PostgreSQL only?\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nActually no. Internally we use SQLAlchemy, which is database agnostic, so theoretically it should work with any database.\nBut since it is raw-SQL based, you need to use same DBMS everywhere.\n\n\nWhat was PGmigrate design goals?\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n* Provide simple framework agnostic way for managing database changes in our projects\n* Use raw SQL. We love raw SQL.\n* Do not have tons of metadata everywhere.\n* No support for downgrades.\n* Support for DVCS-based flows, where you have many branches and frequently do merges between branches.\n* Be simple and powerful\n\nWhy snippets contain SQL instead of programs in some DSL?\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nWe belive that it if you have a good developers \u2014 it makes no sense to hide \npower to SQL from them. So, with PGmigrate you have a full control on what would be executed.\nAlso since we do not have any fancy stuff, PGmigrate is quite simple, and can be used in almost any development model. \n\n\nWhy PGmigrate does not support downgrades (down database migrations)?\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nIn normal circumstances downgrades are rarely used. And since they are rarely used nobody tests them, and/or sometimes do not write them at all.\nWe belive that having unreliable downgrades are worse than not having them at all.\n\n\nSo, if something goes wrong, just roll forwards instead of rolling back. Or, if you really need to roll back, you can craft downgrade SQL manually. \n\n\n\nI want my migrations to be written in Python/Ruby/Shell/whatever?\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nYou can check https://github.com/piranha/nomad/ which has similar design goals, has support for executable patches, but slightly cluttered patches repo structure. \n\nCan I use it in Django?\n^^^^^^^^^^^^^^^^^^^^^^^\nSure. But we do not have a `management commands `_ so far, so, you will\nneed to write them by youself (you can contribute them back to PGmigrate afterwards). \n \n\nContributors\n------------\n\nSergey Kirillov\nMicha\u0142 Papierski", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://bitbucket.org/shopium/pgmigrate2", "keywords": "database migration tool postgres postgresql mysql sqlite", "license": "Apache License 2.0", "maintainer": null, "maintainer_email": null, "name": "pgmigrate2", "package_url": "https://pypi.org/project/pgmigrate2/", "platform": "any", "project_url": "https://pypi.org/project/pgmigrate2/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://bitbucket.org/shopium/pgmigrate2" }, "release_url": "https://pypi.org/project/pgmigrate2/1.2.3/", "requires_dist": null, "requires_python": null, "summary": "Database schema migration tool for people who do not afraid SQL", "version": "1.2.3" }, "last_serial": 931184, "releases": { "0.9": [ { "comment_text": "", "digests": { "md5": "2257b31e4dd24200295750fc9b52832b", "sha256": "d259cce2d5ed43094d22de28390336e557dc290a3b8255233a30f2f9b447e83e" }, "downloads": -1, "filename": "pgmigrate2-0.9.tar.gz", "has_sig": false, "md5_digest": "2257b31e4dd24200295750fc9b52832b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3990, "upload_time": "2011-08-28T10:43:46", "url": "https://files.pythonhosted.org/packages/c8/0a/8e03e175fd442aeaa51028e6d7a4aeca6bfb91aa0eb16ba23ef91b7c855e/pgmigrate2-0.9.tar.gz" } ], "0.9.1": [ { "comment_text": "", "digests": { "md5": "78eb0d8880bb9315ff7b8c0622ea4053", "sha256": "4dbfab58dddc51b5048570631191786cf10833a2feed28a453535611f394a0a0" }, "downloads": -1, "filename": "pgmigrate2-0.9.1.tar.gz", "has_sig": false, "md5_digest": "78eb0d8880bb9315ff7b8c0622ea4053", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3985, "upload_time": "2011-08-28T11:23:13", "url": "https://files.pythonhosted.org/packages/64/0b/b34d833904870f7aa48708c557725021a5251f92b029a2951e7be093ef2f/pgmigrate2-0.9.1.tar.gz" } ], "0.9.2": [ { "comment_text": "", "digests": { "md5": "f800af0cd44cfe735a50216827efd25b", "sha256": "85549bea4b1d16cdba374d0f887a94db02c655eae2da930fb5046203532af29f" }, "downloads": -1, "filename": "pgmigrate2-0.9.2.tar.gz", "has_sig": false, "md5_digest": "f800af0cd44cfe735a50216827efd25b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3996, "upload_time": "2011-08-28T13:06:27", "url": "https://files.pythonhosted.org/packages/16/39/9e8fbbf6e628e366c24adc6b10fb8e88077dd2c23088471a446b56bd7901/pgmigrate2-0.9.2.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "07c0b8452d7f54b504e07ba93b5825f7", "sha256": "b4a2ec8b2334ec7ab3f250fd5242cc3a9b2f0c8738507df2ed69d694a1dfa285" }, "downloads": -1, "filename": "pgmigrate2-1.0.0.tar.gz", "has_sig": false, "md5_digest": "07c0b8452d7f54b504e07ba93b5825f7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4010, "upload_time": "2011-09-14T20:44:41", "url": "https://files.pythonhosted.org/packages/fd/da/47babd6ff74562ca630904e19e3805d76e51944f591bd63afc9432b64737/pgmigrate2-1.0.0.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "9b6be4f26e7822b9026169ff10fe371c", "sha256": "4562e2b950890572cbf3b11d335690f0a32ecb1b20083411b9d9f2d04503ac67" }, "downloads": -1, "filename": "pgmigrate2-1.1.0.tar.gz", "has_sig": false, "md5_digest": "9b6be4f26e7822b9026169ff10fe371c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3974, "upload_time": "2012-03-10T18:08:33", "url": "https://files.pythonhosted.org/packages/85/bd/00972cc2b4b831b7f948aadc26976e39dd4ef78ccc5f2fd83a25ffc216c8/pgmigrate2-1.1.0.tar.gz" } ], "1.2.0": [ { "comment_text": "", "digests": { "md5": "88f86e396098288c53009e84565daa7c", "sha256": "33f421bcd7fccc4f3ba836f9f4ad01b5dde217ef9661da9cf202b31e74fee095" }, "downloads": -1, "filename": "pgmigrate2-1.2.0.tar.gz", "has_sig": false, "md5_digest": "88f86e396098288c53009e84565daa7c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6266, "upload_time": "2012-04-24T20:44:21", "url": "https://files.pythonhosted.org/packages/25/69/02f43f89ac43bc644df5e5e840bbdfbc85ba0e5ed9abf045e653ee1d70eb/pgmigrate2-1.2.0.tar.gz" } ], "1.2.1": [ { "comment_text": "", "digests": { "md5": "22b4c4783c2abe0a37960c4287ff4ea3", "sha256": "cf187c6c77b2600236c138e6e7eee4c066da871678a73f46f08e6bd87b13cb80" }, "downloads": -1, "filename": "pgmigrate2-1.2.1.tar.gz", "has_sig": false, "md5_digest": "22b4c4783c2abe0a37960c4287ff4ea3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6302, "upload_time": "2012-04-25T21:19:04", "url": "https://files.pythonhosted.org/packages/bd/67/e540158e9ae8d1bd210cbe1cdb77d6f84fbb3dbc64ec8b5606f2b0f4824b/pgmigrate2-1.2.1.tar.gz" } ], "1.2.2": [ { "comment_text": "", "digests": { "md5": "faa07a09d378079c43877c0cbc3c4452", "sha256": "9ad279a059a18e98d3929abb20053b963605ba5c0643c63d7190e0cc858f8cc7" }, "downloads": -1, "filename": "pgmigrate2-1.2.2.tar.gz", "has_sig": false, "md5_digest": "faa07a09d378079c43877c0cbc3c4452", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6816, "upload_time": "2012-04-25T21:22:44", "url": "https://files.pythonhosted.org/packages/ba/88/2a51b8d2c86d40fa5bdbafd174d61d47dc0886027a6ea20915eb5d188f4d/pgmigrate2-1.2.2.tar.gz" } ], "1.2.3": [ { "comment_text": "", "digests": { "md5": "4e51fdf3171ae3b49d3d9c6f5e97abcb", "sha256": "30104702212365b8c4be6010ddc260d29325d6be88ea0a3017aaa619ed00fe17" }, "downloads": -1, "filename": "pgmigrate2-1.2.3.tar.gz", "has_sig": false, "md5_digest": "4e51fdf3171ae3b49d3d9c6f5e97abcb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6827, "upload_time": "2013-11-28T14:43:50", "url": "https://files.pythonhosted.org/packages/81/a9/de9045f85dac65c61c8d481754e67071e36f76f8fb07c47ed88038df0afe/pgmigrate2-1.2.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4e51fdf3171ae3b49d3d9c6f5e97abcb", "sha256": "30104702212365b8c4be6010ddc260d29325d6be88ea0a3017aaa619ed00fe17" }, "downloads": -1, "filename": "pgmigrate2-1.2.3.tar.gz", "has_sig": false, "md5_digest": "4e51fdf3171ae3b49d3d9c6f5e97abcb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6827, "upload_time": "2013-11-28T14:43:50", "url": "https://files.pythonhosted.org/packages/81/a9/de9045f85dac65c61c8d481754e67071e36f76f8fb07c47ed88038df0afe/pgmigrate2-1.2.3.tar.gz" } ] }