-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Proof of concept of db_default uuid4() #10958
- Loading branch information
1 parent
449ef94
commit 4011a48
Showing
3 changed files
with
35 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from django.db import models | ||
|
||
|
||
class UUID4(models.Func): | ||
function = "uuid_generate_v4" | ||
arity = 0 | ||
output_field = models.UUIDField() |
24 changes: 24 additions & 0 deletions
24
arches/app/models/migrations/11045_generate_resource_ids.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Generated by Django 5.1.3 on 2024-11-06 12:10 | ||
|
||
import arches.app.models.functions | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("models", "11044_make_further_fields_blank"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="resourceinstance", | ||
name="resourceinstanceid", | ||
field=models.UUIDField( | ||
blank=True, | ||
db_default=arches.app.models.functions.UUID4(), | ||
primary_key=True, | ||
serialize=False, | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters