Skip to content

Commit a596006

Browse files
MONGOID-5510: Upgrading Guide (#5490)
* WIP on Upgrading Guide * Update upgrading.txt --------- Co-authored-by: shields <[email protected]> Co-authored-by: Alex Bevilacqua <[email protected]>
1 parent b28a842 commit a596006

File tree

2 files changed

+120
-0
lines changed

2 files changed

+120
-0
lines changed

docs/release-notes.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Release Notes
99
.. toctree::
1010
:titlesonly:
1111

12+
release-notes/upgrading
1213
release-notes/mongoid-9.0
1314
release-notes/mongoid-8.1
1415
release-notes/mongoid-8.0

docs/release-notes/upgrading.txt

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
.. _upgrading:
2+
3+
*****************
4+
Upgrading Mongoid
5+
*****************
6+
7+
.. default-domain:: mongodb
8+
9+
.. contents:: On this page
10+
:local:
11+
:backlinks: none
12+
:depth: 2
13+
:class: singlecol
14+
15+
16+
Mongoid provides a stable upgrade path for users migrate to new versions.
17+
18+
19+
Versioning
20+
==========
21+
22+
Each Mongoid release has a version number in ``major.minor.patch`` format. Beginning in
23+
Mongoid 7.4, Mongoid uses `Semantic Versioning (SemVer) <https://semver.org/>`_, which
24+
typically means:
25+
26+
- Breaking changes, enablement of new functionality, and removal of deprecated
27+
functionality will only be done in major version releases.
28+
29+
- New functionality will be added using feature flags, which must be enabled via
30+
an opt-in configuration change. These feature flags may be added in either major
31+
or minor releases.
32+
33+
- Functionality may be marked as deprecated in either major or minor releases, but will
34+
not be removed until the next major release, at the earliest.
35+
36+
- Patch version releases will contain only non-breaking fixes and security updates.
37+
38+
.. warning::
39+
40+
Mongoid 7.3 and prior do not strictly adhere to SemVer and may contain breaking changes even
41+
in minor version releases. Users should exercise additional caution when upgrading to
42+
these versions.
43+
44+
45+
How to Upgrade Mongoid
46+
======================
47+
48+
Before you Upgrade
49+
------------------
50+
51+
- *Test Coverage:* The best way to be sure that your application still works after upgrading
52+
is to have good test coverage before you start the process.
53+
54+
- *Upgrade Ruby and Rails:* See `"Upgrading Ruby on Rails" <https://guides.rubyonrails.org/upgrading_ruby_on_rails.html>`_
55+
for more information
56+
57+
58+
Upgrading Mongoid
59+
-----------------
60+
61+
The following outlines our recommended procedure to upgrade to a new Mongoid version:
62+
63+
1. Upgrade to each minor version individually.
64+
65+
For example, if you are upgrading from Mongoid 7.4 to 8.1, we recommend you follow this
66+
procedure for the latest patch version of each minor version, e.g. first to 7.5.x,
67+
then to 8.0.x, and finally to 8.1.x.
68+
69+
2. Before upgrading, ensure you have ``load_defaults`` set to your current version.
70+
71+
If you haven't yet enabled the latest behavior on your current version, you should do so
72+
prior to upgrading.
73+
74+
3. Review the :ref:`Release Notes <release-notes>` carefully when upgrading.
75+
76+
4. Test your app on the new version.
77+
78+
Your app should be tested and released "as-is" on the new Mongoid version _without_ adjusting
79+
``load_defaults`` or any feature flags.
80+
81+
5. Once Step 4 is confirmed to be stable, set ``load_defaults`` to the new version to enable
82+
new functionality. Also fix any deprecation warnings at this time.
83+
84+
You may also enable new functionalities one-by-one using feature flags.
85+
86+
87+
Load Defaults and Feature Flags
88+
-------------------------------
89+
90+
When a feature flag is introduced, it will have a default value that preserves
91+
the previous (legacy) functionality. At this time, users are encouraged to manually
92+
set the flag to its new value in order to try out the new functionality.
93+
94+
In the next major version release, the flag's default value will be flipped to
95+
enable the new functionality. At this time, the flag itself will be marked deprecated.
96+
Finally, the deprecated flag will be removed from the config entirely in a subsequent
97+
major version release.
98+
99+
Feature flags are added as a convenience to facilitate upgrading, but are not intended
100+
to be supported in perpetuity.
101+
102+
103+
Deprecation Policy
104+
------------------
105+
106+
Mongoid may deprecate features, functionality, methods, constants, etc. from
107+
time to time. To do so, Mongoid may take one or more of the following actions:
108+
109+
- Mark the relevant code ``@deprecated`` in a code comment.
110+
111+
- Add a log warning if the deprecated functionality is used.
112+
113+
- Inform of the deprecation in the :ref:`Release Notes <release-notes>`.
114+
115+
Mongoid may then remove the deprecated functionality in the next major version
116+
release.
117+
118+
Methods which are marked ``@api private`` may be removed without deprecation,
119+
even if such methods are ``public`` in Ruby.

0 commit comments

Comments
 (0)