Qfix: consistent space/project/task type mixi ids (#5089)

Signed-off-by: Alexey Zinoviev <alexey.zinoviev@xored.com>
This commit is contained in:
Alexey Zinoviev
2024-03-28 22:49:09 +05:00
committed by GitHub
parent 92d0b93692
commit 095a9b5d6e
2 changed files with 10 additions and 5 deletions
+6 -3
View File
@@ -24,7 +24,6 @@ import core, {
Ref,
Status,
TxOperations,
generateId,
type AnyAttribute,
type Rank,
type RefTo
@@ -209,7 +208,9 @@ export async function createProjectType (
const baseClassClass = client.getHierarchy().getClass(categoryObj.baseClass)
const targetProjectClassId: Ref<Class<Doc>> = generateId()
// NOTE: it is important for this id to be consistent when re-creating the same
// project type with the same id as it will happen during every migration if type is created by the system
const targetProjectClassId = `${_id}:type:mixin` as Ref<Class<Doc>>
const tmpl = await client.createDoc(
task.class.ProjectType,
core.space.Model,
@@ -324,7 +325,9 @@ async function createTaskTypes (
if (tdata.targetClass === undefined) {
// Create target class for custom field.
const targetClassId: Ref<Class<Task>> = generateId()
// NOTE: it is important for this id to be consistent when re-creating the same
// task type with the same id as it will happen during every migration if type is created by the system
const targetClassId = `${taskId}:type:mixin` as Ref<Class<Task>>
tdata.targetClass = targetClassId
await client.createDoc(