Opened 10 years ago
Closed 10 years ago
#643 closed defect (fixed)
Unique contraint for user+slug on collections
|Reported by:||Elrond||Owned by:||rodney757|
|Component:||programming||Keywords:||sql bitesized sprint review|
I think, there should be a unique constraint on (user, slug) on collections.
Rationale: We should not have two collections with the same slug for one user. And we most likely should tell the db about this.
Change History (7)
comment:1 by , 10 years ago
comment:2 by , 10 years ago
comment:3 by , 10 years ago
|Status:||new → accepted|
comment:4 by , 10 years ago
pull request branch: issue643
comment:5 by , 10 years ago
link to repo: https://gitorious.org/~rodney757/mediagoblin/rodney757s-mediagoblin
comment:6 by , 10 years ago
This looks good, though I have not tested it!
If we had larger instances I might be worried about the size of that existing_slugs dict, but as is, it seems fine.
I'll give this a test tomorrow hopefully then I think it should be merged.
comment:7 by , 10 years ago
|Status:||accepted → closed|
Okay, tested it! Things are working, merged to master, and pushed!
The migration should also test for existing entries with the same slug and fix them. Elrond says: use generate_slug!