Skip to content

Conversation

@arthanson
Copy link
Collaborator

Fixes: #10070

Adds unique constraint to L2VPN slug field along with max_length. Note: Would cause issues migrating if someone already has non-unique slugs defined (probably fairly unlikely).

@jeremystretch
Copy link
Member

jeremystretch commented Aug 24, 2022

Looks like a few of the tests are failing simply because they're creating L2VPNs without slug values (which are now required):

l2vpns = (
L2VPN(name='L2VPN 1', type='vxlan', identifier=650001),
L2VPN(name='L2VPN 2', type='vpws', identifier=650002),
L2VPN(name='L2VPN 3', type='vpls'), # No RD
)
L2VPN.objects.bulk_create(l2vpns)

@jeremystretch
Copy link
Member

@arthanson I've just pushed a tweak to develop to add slugs for the affected tests. If you rebase this branch it should pass CI now.

@DanSheps
Copy link
Member

Would it make sense to make slugs unique but non-required?

@jeremystretch
Copy link
Member

Every model which includes a slug field currently requires that field to be populated. Barring any changes per #8113, let's keep consistent with that.

@jeremystretch jeremystretch merged commit 4132027 into netbox-community:develop Aug 24, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Slug for L2VPN has no unique constraint

3 participants