Update README and add CHANGELOG file
This commit is contained in:
1 parent
e45e031820
commit
42d43fd6aa
2 files changed
+128
-7
No files matched your search
+34
-7
@@ -31,7 +31,18 @@ Installation
|
||||
Usage
|
||||
-----
|
||||
|
||||
``django-migration-linter DJANGO_PROJECT_FOLDER [GIT_COMMIT_ID] [--ignore-name-contains=IGNORE_NAME_CONTAINS] [--include-apps INCLUDE_APPS [INCLUDE_APPS ...] | --exclude-apps EXCLUDE_APPS [EXCLUDE_APPS ...]]``
|
||||
|
||||
Add the migration linter your ``INSTALLED_APPS``:
|
||||
|
||||
.. code-block::
|
||||
INSTALLED_APPS = [
|
||||
...,
|
||||
"django_migration_linter",
|
||||
...,
|
||||
]
|
||||
|
||||
|
||||
``python manage.py lintmigrations [GIT_COMMIT_ID] [--ignore-name-contains=IGNORE_NAME_CONTAINS] [--include-apps INCLUDE_APPS [INCLUDE_APPS ...] | --exclude-apps EXCLUDE_APPS [EXCLUDE_APPS ...]]``
|
||||
|
||||
================================================== ===========================================================================================================================
|
||||
Parameter Description
|
||||
@@ -52,7 +63,8 @@ Examples
|
||||
--------
|
||||
|
||||
3YOURMIND is running the linter on every build getting pushed through CI.
|
||||
Checkout the ``examples/`` folder to see how you could integrate the linter in your test suite.
|
||||
That enables to be sure that the migrations will allow A/B testing, Blue/Green deployment and they won't break your development environment.
|
||||
As every reasonable tool, a non-zero error code means that at least one invalid migration has been found.
|
||||
|
||||
Backward incompatible migrations
|
||||
--------------------------------
|
||||
@@ -63,9 +75,10 @@ The linter analyses your migrations and checks the SQL for:
|
||||
- Dropping columns
|
||||
- Renaming columns
|
||||
- Renaming tables
|
||||
- Altering columns (which can be backward compatible and eventually ignored)
|
||||
- Altering columns (which can be backward compatible and potentially ignored)
|
||||
|
||||
Those are the most important and frequent backward incompatible migrations. We are happy to add more if you have some.
|
||||
Those are the most important and frequent backward incompatible migrations.
|
||||
We are happy to add more if you can specify them to us.
|
||||
|
||||
Ignoring migrations
|
||||
-------------------
|
||||
@@ -83,21 +96,35 @@ You can also ignore migrations by adding this to your migrations:
|
||||
]
|
||||
# ...
|
||||
|
||||
.. code-block::
|
||||
The SQL generated by this looks like:
|
||||
--
|
||||
-- The Django migration linter will ignore this migration
|
||||
--
|
||||
select 1; -- dml ignores this migration;
|
||||
|
||||
Cache
|
||||
-----
|
||||
By default, the linter uses a cache to prevent linting the same migration again.
|
||||
By default, the linter uses a cache to prevent linting the same migration multiple times.
|
||||
The default location of the cache on Linux is
|
||||
``/home/<username>/.cache/django-migration-linter/<version>/<ldjango-project>.pickle``.
|
||||
``/home/<username>/.cache/django-migration-linter/<version>/<ldjango-project>_<database_name>.pickle``.
|
||||
|
||||
Since the linter uses hashes, modifying migration files, will re-run the linter on that migration.
|
||||
Since the linter uses hashes of the file's content, modifying a migration file will re-run the linter on that migration.
|
||||
If you want to run the linter without cache, use the flag ``--no-cache``.
|
||||
If you want to invalidate the cache, delete the cache folder.
|
||||
The cache folder can also be defined manually through the ``--cache-path`` option.
|
||||
|
||||
Tests
|
||||
-----
|
||||
|
||||
The easiest way to run the tests is to invoke `tox`_.
|
||||
|
||||
You will need to install the test requirements, which can be found in the ``setup.py`` file.
|
||||
A good way to get started is to install the development version of the linter by doing ``pip install -e .[test]``.
|
||||
|
||||
To be able to fully test the linter, you will need both MySQL and PostgreSQL databases running.
|
||||
You can either tweak the ``tests/test_project/settings.py`` file to get your DB settings right, or to have databases and users corresponding to the default Travis users.
|
||||
|
||||
Contributing
|
||||
------------
|
||||
|
||||
|
||||
Reference in new issue
Block a user