David Wobrock
5695a95f81
Move CHANGELOG line to new features section.
2023-07-09 14:42:35 +02:00
David Cain
86b660fbf6
Also flag concurrent index creation
...
Creating indices concurrently (provided that index creation *completes*)
is generally a much safer way to build an index (since it allows reads
*and* writes to the table during index creation).
However, due to the inherent tradeoffs of concurrent index creation, the
operation will almost always take *longer* than a traditional (blocking)
index creation. It's actually much *more* important to lint against
concurrent index creation when an exclusive lock is open & held.
Test is from a comment by @David-Wobrock (I corrected syntax, though):
https://github.com/3YOURMIND/django-migration-linter/pull/251#discussion_r1249298197
2023-07-09 14:42:35 +02:00
David Cain
15dbe22f24
Add a CHANGELOG entry for the new check
...
5.0.0 will be released soon, be sure that we document this new check!
2023-07-09 14:42:35 +02:00
David Cain
48fac8856b
Downgrade CREATE_INDEX_EXCLUSIVE to a warning
...
While it's always a dangerous *pattern* to create an index while a
transaction is open & holds an exclusive lock, in practice it's not
always a big deal (for example, indexing a table with very few rows can
be fast). Accordingly, downgrade to a warning.
2023-07-09 14:42:35 +02:00
David Cain
0c5519d9dc
Add new check for indexing with atomic=True
...
Briefly, this check helps prevent a long-running index creation from
preventing all reads and writes to a table.
This supplements an existing check
==================================
There is an existing check, `CREATE_INDEX` which warns about creating
indices without the `CONCURRENTLY` argument. It's a helpful check!
However, there are some valid reasons to prefer non-concurrent index
creation. For example, concurrent index creation may struggle to
complete when applied to write-heavy tables (since Postgres will have to
make repeated passes on the table to accommodate the new reads since the
last round).
The danger of `EXCLUSIVE` locks
===============================
If you *do* want to create indices nonconcurrently, there is still a
**huge footgun** to be aware of -- locks which are held in a transaction
are not released until the transaction closes.
Dangerous Django defaults
=========================
By default, any time you add a new Django field with `db_index=True` or
`unique=True`, the automatically generated `Migration` has:
- implicit setting of `atomic=True` (transactions are on)
- an `ALTER TABLE...ADD COLUMN` call (exclusively locks the table)
- a `CREATE INDEX` invocation (*hopefully* quick, due to nullable
columns)
It's even more dangerous if you combine an `ALTER TABLE` call with
`CREATE INDEX` of an existing, non-nullable column.
Favor `atomic=False` if you must index
======================================
Index-creating migrations should have few `operations`. Since index
creation does not modify row-level data (and only requires locking
against writes), there's no reason to use transactions.
It's prudent to bypass the default `atomic=True` for index creation.
2023-07-09 14:42:35 +02:00
David Cain
9fdfa06845
Fix error output when warnings are found
...
We should log the *warnings* found, not errors!
2023-07-09 14:42:35 +02:00
Caspar Wylie
2d15ea84f9
Support partial function inspection in data migrations
2023-07-03 21:02:14 +02:00
David Wobrock
97a1f5c6c9
Fix #250 -- Don't consider partial index creation as making a column not nullable.
2023-07-03 20:41:03 +02:00
David Wobrock
b6acc1dd22
Add Django 4.2 support in CHANGELOG
2023-07-03 20:41:03 +02:00
David Wobrock
366d16b01a
Add Django 4.2 compat' and update test dependencies.
2023-07-02 20:36:03 +02:00
David Wobrock
f511d51d9a
Apply pre-commit hooks on all files.
2023-07-02 20:36:03 +02:00
David Wobrock
7f6e8997eb
Update pre-commit hooks.
2023-07-02 20:36:03 +02:00
David Wobrock
202a6d9d5d
Add files to .gitignore and other improvements.
2022-12-26 16:26:24 +01:00
David Wobrock
f86e0622a5
Add pre-commit hook and use in CI.
2022-12-26 16:26:24 +01:00
David Wobrock
2ee7dac3b3
Add internal classes and add type hints + mypy.
2022-12-26 16:26:24 +01:00
dependabot[bot]
847ac1241a
Bump isort from 5.10.1 to 5.11.3
...
Bumps [isort](https://github.com/pycqa/isort ) from 5.10.1 to 5.11.3.
- [Release notes](https://github.com/pycqa/isort/releases )
- [Changelog](https://github.com/PyCQA/isort/blob/main/CHANGELOG.md )
- [Commits](https://github.com/pycqa/isort/compare/5.10.1...5.11.3 )
---
updated-dependencies:
- dependency-name: isort
dependency-type: direct:development
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com >
2022-12-19 10:30:24 +01:00
David Wobrock
8d0462fe83
Add some commands for publishing.
2022-12-17 12:07:02 +01:00
David Wobrock
b2338ff93b
Stop including test files in dist.
2022-12-17 12:07:02 +01:00
dependabot[bot]
c2a6bf4027
Bump black from 22.10.0 to 22.12.0
...
Bumps [black](https://github.com/psf/black ) from 22.10.0 to 22.12.0.
- [Release notes](https://github.com/psf/black/releases )
- [Changelog](https://github.com/psf/black/blob/main/CHANGES.md )
- [Commits](https://github.com/psf/black/compare/22.10.0...22.12.0 )
---
updated-dependencies:
- dependency-name: black
dependency-type: direct:development
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com >
2022-12-17 11:46:16 +01:00
David Wobrock
d594aa6012
Use Python 3.10 for linting CI tasks and others.
2022-12-17 11:45:19 +01:00
David Wobrock
f9a2e4189c
Support Py3.11 and Django 4.1, and drop Django 2.1 support.
2022-12-17 11:45:19 +01:00
dependabot[bot]
ec5731f298
Bump flake8 from 5.0.4 to 6.0.0
...
Bumps [flake8](https://github.com/pycqa/flake8 ) from 5.0.4 to 6.0.0.
- [Release notes](https://github.com/pycqa/flake8/releases )
- [Commits](https://github.com/pycqa/flake8/compare/5.0.4...6.0.0 )
---
updated-dependencies:
- dependency-name: flake8
dependency-type: direct:development
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com >
2022-11-28 10:10:06 +01:00
Nikita Karamov
cb8492d8a7
Use a context manager to write to /dev/null
2022-11-14 09:01:21 +01:00
David Wobrock
e8f83708b0
Run black.
2022-11-03 22:00:00 +01:00
Sondre Lillebø Gundersen
a9405eaf83
feat: Support Path type for project_root_path
...
Django has switched to using pathlib.Path in startproject. This adds support for these in the project root path config option.
2022-11-03 22:00:00 +01:00
Sondre Lillebø Gundersen
bd4eb89b8c
chore: Upgrade Python syntax with pyupgrade
...
Run with the following pre-commit configuration:
```
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v3.1.0
hooks:
- id: pyupgrade
args: [ "--py3-plus", "--py36-plus", "--py37-plus" ]
```
The rationale for every change can be found at https://github.com/asottile/pyupgrade
2022-11-03 22:00:00 +01:00
dependabot[bot]
92eab3c929
Bump black from 22.8.0 to 22.10.0
...
Bumps [black](https://github.com/psf/black ) from 22.8.0 to 22.10.0.
- [Release notes](https://github.com/psf/black/releases )
- [Changelog](https://github.com/psf/black/blob/main/CHANGES.md )
- [Commits](https://github.com/psf/black/compare/22.8.0...22.10.0 )
---
updated-dependencies:
- dependency-name: black
dependency-type: direct:development
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com >
2022-10-12 18:34:52 +02:00
Sören Wegener
a3fc5f1a50
Improve error message when an unsupported database vendor/SQL analyser was selected.
2022-10-03 15:48:11 +02:00
David Wobrock
9ad7bcced0
Add release not for IgnoreMigration.elidable=True change.
2022-10-03 15:47:49 +02:00
Tobias Krönke
d1c1388f28
feat(IgnoreMigration): elidable by default to support squashing
2022-10-03 15:47:49 +02:00
dependabot[bot]
da5e7b88f4
Bump codecov/codecov-action from 3.1.0 to 3.1.1
...
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action ) from 3.1.0 to 3.1.1.
- [Release notes](https://github.com/codecov/codecov-action/releases )
- [Changelog](https://github.com/codecov/codecov-action/blob/master/CHANGELOG.md )
- [Commits](https://github.com/codecov/codecov-action/compare/v3.1.0...v3.1.1 )
---
updated-dependencies:
- dependency-name: codecov/codecov-action
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com >
2022-10-03 15:22:00 +02:00
dependabot[bot]
62d5ece51f
Bump black from 22.6.0 to 22.8.0
...
Bumps [black](https://github.com/psf/black ) from 22.6.0 to 22.8.0.
- [Release notes](https://github.com/psf/black/releases )
- [Changelog](https://github.com/psf/black/blob/main/CHANGES.md )
- [Commits](https://github.com/psf/black/compare/22.6.0...22.8.0 )
---
updated-dependencies:
- dependency-name: black
dependency-type: direct:development
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com >
2022-09-05 17:17:52 +02:00
David Wobrock
6ba29a6b5d
Fix flake8 linting.
2022-08-07 17:06:10 +02:00
David Wobrock
1fb2b62fc3
Upgrade flake8 to 5.0.4.
2022-08-07 17:06:10 +02:00
dependabot[bot]
c69da5e1dd
Bump flake8 from 4.0.1 to 5.0.1
...
Bumps [flake8](https://github.com/pycqa/flake8 ) from 4.0.1 to 5.0.1.
- [Release notes](https://github.com/pycqa/flake8/releases )
- [Commits](https://github.com/pycqa/flake8/compare/4.0.1...5.0.1 )
---
updated-dependencies:
- dependency-name: flake8
dependency-type: direct:development
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com >
2022-08-07 17:06:10 +02:00
David Wobrock
bef47906d1
Fix #209 - Raise when getting SQL statements fail.
2022-07-28 23:45:14 +02:00
David Wobrock
74a7ee9239
Remove remaining __future__ imports.
2022-07-23 11:59:50 +02:00
David Wobrock
f67f27354d
Fix #218 - Handle model 'objects' call with other parts in the name.
2022-07-09 15:37:57 +02:00
David Wobrock
3baf9487bd
Remove test deps mysqlclient and psycopg2 upper version bound.
2022-07-09 15:16:14 +02:00
dependabot[bot]
be5486a97a
Bump black from 22.3.0 to 22.6.0
...
Bumps [black](https://github.com/psf/black ) from 22.3.0 to 22.6.0.
- [Release notes](https://github.com/psf/black/releases )
- [Changelog](https://github.com/psf/black/blob/main/CHANGES.md )
- [Commits](https://github.com/psf/black/compare/22.3.0...22.6.0 )
---
updated-dependencies:
- dependency-name: black
dependency-type: direct:development
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com >
2022-07-09 15:15:10 +02:00
dependabot[bot]
99548890c9
Bump codecov/codecov-action from 3.0.0 to 3.1.0
...
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action ) from 3.0.0 to 3.1.0.
- [Release notes](https://github.com/codecov/codecov-action/releases )
- [Changelog](https://github.com/codecov/codecov-action/blob/master/CHANGELOG.md )
- [Commits](https://github.com/codecov/codecov-action/compare/v3.0.0...v3.1.0 )
---
updated-dependencies:
- dependency-name: codecov/codecov-action
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com >
2022-07-02 19:52:05 +02:00
dependabot[bot]
9085e005ae
Bump actions/setup-python from 3 to 4
...
Bumps [actions/setup-python](https://github.com/actions/setup-python ) from 3 to 4.
- [Release notes](https://github.com/actions/setup-python/releases )
- [Commits](https://github.com/actions/setup-python/compare/v3...v4 )
---
updated-dependencies:
- dependency-name: actions/setup-python
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com >
2022-06-13 17:40:08 +02:00
David Wobrock
ea227eb364
Bump to 4.1.0
2022-04-24 18:00:55 +02:00
dependabot[bot]
00c3c7e0f4
Bump codecov/codecov-action from 2.1.0 to 3.0.0
...
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action ) from 2.1.0 to 3.0.0.
- [Release notes](https://github.com/codecov/codecov-action/releases )
- [Changelog](https://github.com/codecov/codecov-action/blob/master/CHANGELOG.md )
- [Commits](https://github.com/codecov/codecov-action/compare/v2.1.0...v3.0.0 )
---
updated-dependencies:
- dependency-name: codecov/codecov-action
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com >
2022-04-24 18:00:15 +02:00
dependabot[bot]
4c3190dd44
Bump black from 22.1.0 to 22.3.0
...
Bumps [black](https://github.com/psf/black ) from 22.1.0 to 22.3.0.
- [Release notes](https://github.com/psf/black/releases )
- [Changelog](https://github.com/psf/black/blob/main/CHANGES.md )
- [Commits](https://github.com/psf/black/compare/22.1.0...22.3.0 )
---
updated-dependencies:
- dependency-name: black
dependency-type: direct:development
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com >
2022-04-24 17:53:31 +02:00
David Wobrock
232c7dd136
Add row to changelog
2022-03-19 20:12:03 +01:00
Phillip Verheyden
88a7b0812a
Allow project_root_path and verbosity to come from Django settings
...
And still fallback to DJANGO_SETTINGS_MODULE environ for project_root_path if not explicitly set
Fixes #203
2022-03-19 20:12:03 +01:00
David Wobrock
c2ad3e6aeb
Allow passing '--sql-analyser' to makemigrations command
2022-03-13 17:54:04 +01:00
David Wobrock
c7d9129db9
Adapt 'warnings-as-errors' option to allow taking migration test codes as input
2022-03-13 17:26:40 +01:00
David Wobrock
a04ecc078a
Update CHANGELOG.md
2022-03-13 16:51:29 +01:00