Skip to content

Commit 0eee780

Browse files
Add steps for running uniqueness rules
1 parent f81b9f1 commit 0eee780

File tree

3 files changed

+62
-0
lines changed

3 files changed

+62
-0
lines changed

sphinx/index.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
Welcome to Specify Developer documentation!
22
===========================================================
33

4+
.. toctree::
5+
:maxdepth: 1
6+
:caption: Specify:
7+
8+
specify/adding_new_levels
9+
410
.. toctree::
511
:maxdepth: 1
612
:caption: Amazon Web Services:

sphinx/specify/adding_new_levels.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Steps After Adding a New Institutional Scoping Level in Specify 7
2+
3+
_Last updated 2024-12-09_
4+
5+
After adding a new [institutional scoping level](https://discourse.specifysoftware.org/t/specify-institutional-scopings/1046) (collection, discipline, division) to a Specify 7 database, follow these steps:
6+
7+
![Example hierarchy](https://global.discourse-cdn.com/flex029/uploads/specifysoftware/original/2X/d/d48c17f6c1a95289032a45963388ee499f20f889.jpeg)
8+
9+
![Scoping hierarchy](scopinghierarchy.png)
10+
11+
> **WARNING:** Before following any of these steps, make sure to take a complete backup of any production database.
12+
13+
## Collection
14+
15+
_WIP_
16+
17+
## Discipline
18+
19+
### Uniqueness Rules
20+
21+
**Problem:** When a new discipline is added, the uniqueness rules are not automatically applied. This occurs because the migration process that creates the uniqueness rules is not already complete and does not run again.
22+
23+
> ⚠️ **Warning:** Make sure to note any custom uniqueness rules. If any do not match the system's defaults, carefully back them up and re-add them once these steps are complete.
24+
25+
26+
**Solution:**
27+
28+
1. Drop the `uniquenessrule_fields` table.
29+
2. Drop the `uniquenessrule` table.
30+
3. Remove the Django migration records associated with these migrations:
31+
32+
```sql
33+
delete from django_migrations where name IN ('0001_initial','0002_default_unique_rules');
34+
```
35+
36+
4. Enter the container directly via command line:
37+
38+
```bash
39+
docker exec -it specifycloud-example-1 /bin/bash
40+
```
41+
42+
Inside the Docker `specify7` container, re-run the migrations:
43+
```bash
44+
ve/bin/python manage.py migrate businessrules 0002_default_unique_rules
45+
```
46+
47+
5. Verify that the `uniquenessrule_fields` and `uniquenessrule` tables are present. Go to the Schema Config in each discipline and verify that 'Collection Object' has a uniqueness rule for catalog number.
48+
49+
50+
## Division
51+
52+
_WIP_
53+
54+
## Institution
55+
56+
You may only have one institution per Specify database at this time.

sphinx/specify/scopinghierarchy.png

206 KB
Loading

0 commit comments

Comments
 (0)