diff options
author | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2014-11-16 22:34:29 +0100 |
---|---|---|
committer | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2014-11-16 22:34:29 +0100 |
commit | 13d310fa14f4e4b9a559f8b7887f2a2492357013 (patch) | |
tree | 4ce6820ef321dceb9b6e1e687534b622e335f444 /docs | |
parent | 827af8f13a1b768a75264874c73cc0e620177262 (diff) | |
download | factory-boy-13d310fa14f4e4b9a559f8b7887f2a2492357013.tar factory-boy-13d310fa14f4e4b9a559f8b7887f2a2492357013.tar.gz |
Remove automagic pk-based sequence setup
Related to issues #78, #92, #103, #111, #153, #170
The default value of all sequences is now 0; the automagic
``_setup_next_sequence`` behavior of Django/SQLAlchemy has been removed.
This feature's only goal was to allow the following scenario:
1. Run a Python script that uses MyFactory.create() a couple of times
(with a unique field based on the sequence counter)
2. Run the same Python script a second time
Without the magical ``_setup_next_sequence``, the Sequence counter would be set
to 0 at the beginning of each script run, so both runs would generate objects
with the same values for the unique field ; thus conflicting and crashing.
The above behavior having only a very limited use and bringing various
issues (hitting the database on ``build()``, problems with non-integer
or composite primary key columns, ...), it has been removed.
It could still be emulated through custom ``_setup_next_sequence``
methods, or by calling ``MyFactory.reset_sequence()``.
Diffstat (limited to 'docs')
-rw-r--r-- | docs/changelog.rst | 13 | ||||
-rw-r--r-- | docs/orms.rst | 2 |
2 files changed, 12 insertions, 3 deletions
diff --git a/docs/changelog.rst b/docs/changelog.rst index 7d77f7f..018ec60 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -2,6 +2,17 @@ ChangeLog ========= +.. _v2.5.0: + +2.5.0 (master) +-------------- + +*Deprecation:* + + - Remove deprecated features from :ref:`v2.4.0` + - Remove the auto-magical sequence setup (based on the latest primary key value in the database) for Django and SQLAlchemy; + this relates to issues :issue:`170`, :issue:`153`, :issue:`111`, :issue:`103`, :issue:`92`, :issue:`78`. + .. _v2.4.1: 2.4.1 (2014-06-23) @@ -19,7 +30,7 @@ ChangeLog *New:* - Add support for :attr:`factory.fuzzy.FuzzyInteger.step`, thanks to `ilya-pirogov <https://github.com/ilya-pirogov>`_ (:issue:`120`) - - Add :meth:`~factory.django.mute_signals` decorator to temporarily disable some signals, thanks to `ilya-pirogov <https://github.com>`_ (:issue:`122`) + - Add :meth:`~factory.django.mute_signals` decorator to temporarily disable some signals, thanks to `ilya-pirogov <https://github.com/ilya-pirogov>`_ (:issue:`122`) - Add :class:`~factory.fuzzy.FuzzyFloat` (:issue:`124`) - Declare target model and other non-declaration fields in a ``class Meta`` section. diff --git a/docs/orms.rst b/docs/orms.rst index 2aa27b2..88d49e9 100644 --- a/docs/orms.rst +++ b/docs/orms.rst @@ -35,7 +35,6 @@ All factories for a Django :class:`~django.db.models.Model` should use the * The :attr:`~factory.FactoryOptions.model` attribute also supports the ``'app.Model'`` syntax * :func:`~factory.Factory.create()` uses :meth:`Model.objects.create() <django.db.models.query.QuerySet.create>` - * :func:`~factory.Factory._setup_next_sequence()` selects the next unused primary key value * When using :class:`~factory.RelatedFactory` or :class:`~factory.PostGeneration` attributes, the base object will be :meth:`saved <django.db.models.Model.save>` once all post-generation hooks have run. @@ -284,7 +283,6 @@ To work, this class needs an `SQLAlchemy`_ session object affected to the :attr: This class provides the following features: * :func:`~factory.Factory.create()` uses :meth:`sqlalchemy.orm.session.Session.add` - * :func:`~factory.Factory._setup_next_sequence()` selects the next unused primary key value .. attribute:: FACTORY_SESSION |