Skip to content

Commit 96338c0

Browse files
peteeckeljeremystretch
authored andcommitted
Updated the documentation section about removing plugins
1 parent 00d23a0 commit 96338c0

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

docs/plugins/removal.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,19 @@ DROP TABLE
7070
netbox=> DROP TABLE pluginname_bar;
7171
DROP TABLE
7272
```
73+
74+
### Remove the Django Migration Records
75+
76+
After removing the tables created by a plugin, the migrations that created the tables need to be removed from Django's migration history as well. This is necessary to make it possible to reinstall the plugin at a later time. If the migration history were left in place, Django would skip all migrations that were executed in the course of a previous installation, which would cause the plugin to fail after reinstallation.
77+
78+
```no-highlight
79+
netbox=> SELECT * FROM django_migrations WHERE app='pluginname';
80+
id | app | name | applied
81+
-----+------------+------------------------+-------------------------------
82+
492 | pluginname | 0001_initial | 2023-12-21 11:59:59.325995+00
83+
493 | pluginname | 0002_add_foo | 2023-12-21 11:59:59.330026+00
84+
netbox=> DELETE FROM django_migrations WHERE app='pluginname';
85+
```
86+
87+
!!! warning
88+
Exercise extreme caution when altering Django system tables. Users are strongly encouraged to perform a backup of their database immediately before taking these actions.

0 commit comments

Comments
 (0)