Skip to content
Snippets Groups Projects
Verified Commit 2b58ac27 authored by Erwan Rouchet's avatar Erwan Rouchet
Browse files

Pluck uuid-ossp extension

parent eaf9a390
No related branches found
No related tags found
1 merge request!2405Pluck uuid-ossp extension
......@@ -6,7 +6,6 @@ import django.contrib.postgres.fields.hstore
import django.core.validators
import django.db.models.deletion
import enumfields.fields
from django.contrib.postgres.operations import CreateExtension
from django.db import migrations, models
import arkindex.documents.dates
......@@ -23,7 +22,6 @@ class Migration(migrations.Migration):
]
operations = [
CreateExtension("uuid-ossp"),
migrations.CreateModel(
name="AllowedMetaData",
fields=[
......
......@@ -431,7 +431,7 @@ class Element(IndexableModel):
query = """
INSERT INTO documents_elementpath (id, element_id, path, ordering)
SELECT
uuid_generate_v4(),
gen_random_uuid(),
%(self_id)s,
path || %(parent_id)s,
%(ordering)s
......@@ -483,7 +483,7 @@ class Element(IndexableModel):
query = """
INSERT INTO documents_elementpath (id, element_id, path, ordering)
SELECT
uuid_generate_v4(),
gen_random_uuid(),
child_paths.element_id,
new_parent_paths.path || %(new_parent_id)s || child_paths.path[%(start_index)s:],
child_paths.ordering
......
......@@ -56,7 +56,7 @@ class ActivityManager(Manager):
INSERT INTO process_workeractivity
(element_id, worker_version_id, configuration_id, model_version_id, state, process_id, id, created, updated)
SELECT
elt.id, %s, %s, %s, 'queued', %s, uuid_generate_v4(), current_timestamp, current_timestamp
elt.id, %s, %s, %s, 'queued', %s, gen_random_uuid(), current_timestamp, current_timestamp
FROM ({sql}) AS elt
ON CONFLICT {conflict_target} DO UPDATE SET
process_id = EXCLUDED.process_id,
......
......@@ -33,7 +33,7 @@ SELECT EXISTS
AND path[array_length(path, 1)] = '{A}'::uuid ) ;
INSERT INTO documents_elementpath (id, element_id, path, ordering)
SELECT uuid_generate_v4(),
SELECT gen_random_uuid(),
'{B}'::uuid,
path || '{A}'::uuid,
1
......@@ -52,7 +52,7 @@ SET "path" = array_cat(ARRAY['{first_parent}'::uuid, '{A}'::uuid], "documents_el
WHERE "documents_elementpath"."path" && (ARRAY['{B}'::uuid])::uuid[];
INSERT INTO documents_elementpath (id, element_id, path, ordering)
SELECT uuid_generate_v4(),
SELECT gen_random_uuid(),
child_paths.element_id,
new_parent_paths.path || '{A}'::uuid || child_paths.path[3:],
child_paths.ordering
......
......@@ -33,7 +33,7 @@ SELECT EXISTS
AND path[array_length(path, 1)] = '{A}'::uuid ) ;
INSERT INTO documents_elementpath (id, element_id, path, ordering)
SELECT uuid_generate_v4(),
SELECT gen_random_uuid(),
'{B}'::uuid,
path || '{A}'::uuid,
1
......@@ -41,7 +41,7 @@ FROM documents_elementpath
WHERE element_id = '{A}'::uuid ;
INSERT INTO documents_elementpath (id, element_id, path, ordering)
SELECT uuid_generate_v4(),
SELECT gen_random_uuid(),
child_paths.element_id,
new_parent_paths.path || '{A}'::uuid || child_paths.path[2:],
child_paths.ordering
......
......@@ -5,7 +5,7 @@ SELECT elt.id,
'{model_version_id}'::uuid,
'queued',
'{process_id}'::uuid,
uuid_generate_v4(),
gen_random_uuid(),
current_timestamp,
current_timestamp
FROM
......
......@@ -5,7 +5,7 @@ SELECT elt.id,
'{model_version_id}'::uuid,
'queued',
'{process_id}'::uuid,
uuid_generate_v4(),
gen_random_uuid(),
current_timestamp,
current_timestamp
FROM
......
......@@ -5,7 +5,7 @@ SELECT elt.id,
NULL,
'queued',
'{process_id}'::uuid,
uuid_generate_v4(),
gen_random_uuid(),
current_timestamp,
current_timestamp
FROM
......
......@@ -5,7 +5,7 @@ SELECT elt.id,
NULL,
'queued',
'{process_id}'::uuid,
uuid_generate_v4(),
gen_random_uuid(),
current_timestamp,
current_timestamp
FROM
......
......@@ -51,7 +51,7 @@ class Migration(migrations.Migration):
[
"""
INSERT INTO training_datasetset (id, dataset_id, name)
SELECT uuid_generate_v4(), ds.id, ds.set
SELECT gen_random_uuid(), ds.id, ds.set
FROM (
SELECT DISTINCT id, unnest(sets) AS set
FROM training_dataset
......@@ -59,7 +59,7 @@ class Migration(migrations.Migration):
""",
"""
INSERT INTO training_datasetset (id, dataset_id, name)
SELECT uuid_generate_v4(), sets.dataset_id, sets.set
SELECT gen_random_uuid(), sets.dataset_id, sets.set
FROM (
SELECT DISTINCT dataset_id, set
FROM training_datasetelement
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment