lamindb 0.77.2__py3-none-any.whl → 1.0rc1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. lamindb/__init__.py +39 -32
  2. lamindb/_artifact.py +95 -64
  3. lamindb/_can_curate.py +19 -10
  4. lamindb/_collection.py +51 -49
  5. lamindb/_feature.py +9 -9
  6. lamindb/_finish.py +99 -86
  7. lamindb/_from_values.py +20 -17
  8. lamindb/_is_versioned.py +2 -1
  9. lamindb/_parents.py +23 -16
  10. lamindb/_query_manager.py +3 -3
  11. lamindb/_query_set.py +85 -18
  12. lamindb/_record.py +121 -46
  13. lamindb/_run.py +3 -3
  14. lamindb/_save.py +14 -8
  15. lamindb/{_feature_set.py → _schema.py} +34 -31
  16. lamindb/_storage.py +2 -1
  17. lamindb/_transform.py +51 -23
  18. lamindb/_ulabel.py +17 -8
  19. lamindb/_view.py +15 -14
  20. lamindb/base/__init__.py +24 -0
  21. lamindb/base/fields.py +281 -0
  22. lamindb/base/ids.py +103 -0
  23. lamindb/base/types.py +51 -0
  24. lamindb/base/users.py +30 -0
  25. lamindb/base/validation.py +67 -0
  26. lamindb/core/__init__.py +19 -14
  27. lamindb/core/_context.py +297 -228
  28. lamindb/core/_data.py +44 -49
  29. lamindb/core/_describe.py +41 -31
  30. lamindb/core/_django.py +59 -44
  31. lamindb/core/_feature_manager.py +192 -168
  32. lamindb/core/_label_manager.py +22 -22
  33. lamindb/core/_mapped_collection.py +17 -14
  34. lamindb/core/_settings.py +1 -12
  35. lamindb/core/_sync_git.py +56 -9
  36. lamindb/core/_track_environment.py +1 -1
  37. lamindb/core/datasets/_core.py +5 -6
  38. lamindb/core/exceptions.py +0 -7
  39. lamindb/core/fields.py +1 -1
  40. lamindb/core/loaders.py +18 -2
  41. lamindb/core/{schema.py → relations.py} +22 -19
  42. lamindb/core/storage/_anndata_accessor.py +1 -2
  43. lamindb/core/storage/_backed_access.py +2 -1
  44. lamindb/core/storage/_tiledbsoma.py +40 -13
  45. lamindb/core/storage/objects.py +1 -1
  46. lamindb/core/storage/paths.py +13 -8
  47. lamindb/core/subsettings/__init__.py +0 -2
  48. lamindb/core/types.py +2 -23
  49. lamindb/core/versioning.py +11 -7
  50. lamindb/{_curate.py → curators/__init__.py} +700 -57
  51. lamindb/curators/_spatial.py +528 -0
  52. lamindb/integrations/_vitessce.py +1 -3
  53. lamindb/migrations/0052_squashed.py +1261 -0
  54. lamindb/migrations/0053_alter_featureset_hash_alter_paramvalue_created_by_and_more.py +57 -0
  55. lamindb/migrations/0054_alter_feature_previous_runs_and_more.py +35 -0
  56. lamindb/migrations/0055_artifact_type_artifactparamvalue_and_more.py +61 -0
  57. lamindb/migrations/0056_rename_ulabel_ref_is_name_artifactulabel_label_ref_is_name_and_more.py +22 -0
  58. lamindb/migrations/0057_link_models_latest_report_and_others.py +356 -0
  59. lamindb/migrations/0058_artifact__actions_collection__actions.py +22 -0
  60. lamindb/migrations/0059_alter_artifact__accessor_alter_artifact__hash_type_and_more.py +31 -0
  61. lamindb/migrations/0060_alter_artifact__actions.py +22 -0
  62. lamindb/migrations/0061_alter_collection_meta_artifact_alter_run_environment_and_more.py +45 -0
  63. lamindb/migrations/0062_add_is_latest_field.py +32 -0
  64. lamindb/migrations/0063_populate_latest_field.py +45 -0
  65. lamindb/migrations/0064_alter_artifact_version_alter_collection_version_and_more.py +33 -0
  66. lamindb/migrations/0065_remove_collection_feature_sets_and_more.py +22 -0
  67. lamindb/migrations/0066_alter_artifact__feature_values_and_more.py +352 -0
  68. lamindb/migrations/0067_alter_featurevalue_unique_together_and_more.py +20 -0
  69. lamindb/migrations/0068_alter_artifactulabel_unique_together_and_more.py +20 -0
  70. lamindb/migrations/0069_alter_artifact__accessor_alter_artifact__hash_type_and_more.py +1294 -0
  71. lamindb/migrations/0069_squashed.py +1770 -0
  72. lamindb/migrations/0070_lamindbv1_migrate_data.py +78 -0
  73. lamindb/migrations/0071_lamindbv1_migrate_schema.py +741 -0
  74. lamindb/migrations/0072_remove_user__branch_code_remove_user_aux_and_more.py +148 -0
  75. lamindb/migrations/0073_merge_ourprojects.py +945 -0
  76. lamindb/migrations/0074_lamindbv1_part4.py +374 -0
  77. lamindb/migrations/0075_lamindbv1_part5.py +276 -0
  78. lamindb/migrations/0076_lamindbv1_part6.py +621 -0
  79. lamindb/migrations/0077_lamindbv1_part6b.py +228 -0
  80. lamindb/migrations/0078_lamindbv1_part6c.py +468 -0
  81. lamindb/migrations/0079_alter_rundata_value_json_and_more.py +36 -0
  82. lamindb/migrations/__init__.py +0 -0
  83. lamindb/models.py +4064 -0
  84. {lamindb-0.77.2.dist-info → lamindb-1.0rc1.dist-info}/METADATA +15 -20
  85. lamindb-1.0rc1.dist-info/RECORD +100 -0
  86. {lamindb-0.77.2.dist-info → lamindb-1.0rc1.dist-info}/WHEEL +1 -1
  87. lamindb/core/subsettings/_transform_settings.py +0 -21
  88. lamindb-0.77.2.dist-info/RECORD +0 -63
  89. {lamindb-0.77.2.dist-info → lamindb-1.0rc1.dist-info}/LICENSE +0 -0
@@ -0,0 +1,741 @@
1
+ # Generated by Django 5.2 on 2025-01-05 11:58
2
+
3
+ import django.db.models.deletion
4
+ from django.db import migrations, models
5
+ from lamindb_setup.core.hashing import hash_dict
6
+
7
+ import lamindb.base.fields
8
+
9
+
10
+ def create_default_space(apps, schema_editor):
11
+ Space = apps.get_model("lamindb", "Space")
12
+ Space.objects.get_or_create(
13
+ name="All",
14
+ description="Every team & user with access to the instance has access.",
15
+ )
16
+
17
+
18
+ def populate_hashes(apps, schema_editor):
19
+ ParamValue = apps.get_model("lamindb", "ParamValue")
20
+
21
+ # Process all existing records
22
+ for param_value in ParamValue.objects.all():
23
+ value = param_value.value
24
+ # Check if value is a dict or list (complex JSON)
25
+ if isinstance(value, dict):
26
+ value_hash = hash_dict(value)
27
+ param_value.hash = value_hash
28
+ param_value.save()
29
+
30
+
31
+ class Migration(migrations.Migration):
32
+ dependencies = [
33
+ ("lamindb", "0070_lamindbv1_migrate_data"),
34
+ ]
35
+
36
+ operations = [
37
+ # create Space model
38
+ migrations.CreateModel(
39
+ name="Space",
40
+ fields=[
41
+ ("id", models.SmallAutoField(primary_key=True, serialize=False)),
42
+ ("name", models.CharField(db_index=True, max_length=100)),
43
+ (
44
+ "description",
45
+ lamindb.base.fields.CharField(
46
+ blank=True, default=None, max_length=255, null=True
47
+ ),
48
+ ),
49
+ (
50
+ "created_at",
51
+ lamindb.base.fields.DateTimeField(
52
+ auto_now_add=True,
53
+ db_index=True,
54
+ default=django.utils.timezone.now,
55
+ ),
56
+ ),
57
+ (
58
+ "created_by",
59
+ lamindb.base.fields.ForeignKey(
60
+ blank=True,
61
+ default=None,
62
+ null=True,
63
+ on_delete=django.db.models.deletion.CASCADE,
64
+ related_name="+",
65
+ to="lamindb.user",
66
+ ),
67
+ ),
68
+ ],
69
+ options={
70
+ "abstract": False,
71
+ },
72
+ ),
73
+ # populate the default space
74
+ migrations.RunPython(create_default_space),
75
+ # add space field to all models
76
+ migrations.AddField(
77
+ model_name="artifact",
78
+ name="space",
79
+ field=lamindb.base.fields.ForeignKey(
80
+ blank=True,
81
+ default=1,
82
+ on_delete=django.db.models.deletion.PROTECT,
83
+ to="lamindb.space",
84
+ ),
85
+ ),
86
+ migrations.AddField(
87
+ model_name="collection",
88
+ name="space",
89
+ field=lamindb.base.fields.ForeignKey(
90
+ blank=True,
91
+ default=1,
92
+ on_delete=django.db.models.deletion.PROTECT,
93
+ to="lamindb.space",
94
+ ),
95
+ ),
96
+ migrations.AddField(
97
+ model_name="feature",
98
+ name="space",
99
+ field=lamindb.base.fields.ForeignKey(
100
+ blank=True,
101
+ default=1,
102
+ on_delete=django.db.models.deletion.PROTECT,
103
+ to="lamindb.space",
104
+ ),
105
+ ),
106
+ migrations.AddField(
107
+ model_name="featureset",
108
+ name="space",
109
+ field=lamindb.base.fields.ForeignKey(
110
+ blank=True,
111
+ default=1,
112
+ on_delete=django.db.models.deletion.PROTECT,
113
+ to="lamindb.space",
114
+ ),
115
+ ),
116
+ migrations.AddField(
117
+ model_name="featurevalue",
118
+ name="space",
119
+ field=lamindb.base.fields.ForeignKey(
120
+ blank=True,
121
+ default=1,
122
+ on_delete=django.db.models.deletion.PROTECT,
123
+ to="lamindb.space",
124
+ ),
125
+ ),
126
+ migrations.AddField(
127
+ model_name="param",
128
+ name="space",
129
+ field=lamindb.base.fields.ForeignKey(
130
+ blank=True,
131
+ default=1,
132
+ on_delete=django.db.models.deletion.PROTECT,
133
+ to="lamindb.space",
134
+ ),
135
+ ),
136
+ migrations.AddField(
137
+ model_name="paramvalue",
138
+ name="space",
139
+ field=lamindb.base.fields.ForeignKey(
140
+ blank=True,
141
+ default=1,
142
+ on_delete=django.db.models.deletion.PROTECT,
143
+ to="lamindb.space",
144
+ ),
145
+ ),
146
+ migrations.AddField(
147
+ model_name="run",
148
+ name="space",
149
+ field=lamindb.base.fields.ForeignKey(
150
+ blank=True,
151
+ default=1,
152
+ on_delete=django.db.models.deletion.PROTECT,
153
+ to="lamindb.space",
154
+ ),
155
+ ),
156
+ migrations.AddField(
157
+ model_name="storage",
158
+ name="space",
159
+ field=lamindb.base.fields.ForeignKey(
160
+ blank=True,
161
+ default=1,
162
+ on_delete=django.db.models.deletion.PROTECT,
163
+ to="lamindb.space",
164
+ ),
165
+ ),
166
+ migrations.AddField(
167
+ model_name="transform",
168
+ name="space",
169
+ field=lamindb.base.fields.ForeignKey(
170
+ blank=True,
171
+ default=1,
172
+ on_delete=django.db.models.deletion.PROTECT,
173
+ to="lamindb.space",
174
+ ),
175
+ ),
176
+ migrations.AddField(
177
+ model_name="ulabel",
178
+ name="space",
179
+ field=lamindb.base.fields.ForeignKey(
180
+ blank=True,
181
+ default=1,
182
+ on_delete=django.db.models.deletion.PROTECT,
183
+ to="lamindb.space",
184
+ ),
185
+ ),
186
+ migrations.AddField(
187
+ model_name="user",
188
+ name="space",
189
+ field=lamindb.base.fields.ForeignKey(
190
+ blank=True,
191
+ default=1,
192
+ on_delete=django.db.models.deletion.PROTECT,
193
+ to="lamindb.space",
194
+ ),
195
+ ),
196
+ # changes to transform
197
+ migrations.RemoveField(
198
+ model_name="transform",
199
+ name="_source_code_artifact",
200
+ ),
201
+ # prepare removal of legacy description field
202
+ migrations.RunSQL(
203
+ sql="""
204
+ UPDATE lamindb_transform
205
+ SET name = name || ' ' || description
206
+ WHERE description IS NOT NULL
207
+ AND description != '';
208
+ """
209
+ ),
210
+ migrations.RemoveField(
211
+ model_name="transform",
212
+ name="description",
213
+ ),
214
+ migrations.RenameField(
215
+ model_name="transform",
216
+ old_name="name",
217
+ new_name="description",
218
+ ),
219
+ migrations.AlterField(
220
+ model_name="transform",
221
+ name="key",
222
+ field=lamindb.base.fields.CharField(
223
+ blank=True, db_index=True, default=None, max_length=255, null=True
224
+ ),
225
+ ),
226
+ migrations.AlterField(
227
+ model_name="transform",
228
+ name="description",
229
+ field=lamindb.base.fields.CharField(
230
+ blank=True, db_index=True, default=None, max_length=255, null=True
231
+ ),
232
+ ),
233
+ migrations.RunSQL(
234
+ sql="""
235
+ UPDATE lamindb_transform
236
+ SET key = description
237
+ WHERE key IS NULL and description IS NOT NULL;
238
+ """
239
+ ),
240
+ # visibility -> _branch_code
241
+ migrations.RenameField(
242
+ model_name="collection",
243
+ old_name="name",
244
+ new_name="key",
245
+ ),
246
+ migrations.AlterField(
247
+ model_name="collection",
248
+ name="key",
249
+ field=lamindb.base.fields.CharField(
250
+ blank=True, db_index=True, default=None, max_length=255
251
+ ),
252
+ ),
253
+ # visibility -> _branch_code
254
+ migrations.RenameField(
255
+ model_name="artifact",
256
+ old_name="visibility",
257
+ new_name="_branch_code",
258
+ ),
259
+ migrations.RenameField(
260
+ model_name="collection",
261
+ old_name="visibility",
262
+ new_name="_branch_code",
263
+ ),
264
+ migrations.AlterField(
265
+ model_name="artifact",
266
+ name="_branch_code",
267
+ field=models.SmallIntegerField(db_index=True, default=1, db_default=1),
268
+ ),
269
+ migrations.AlterField(
270
+ model_name="collection",
271
+ name="_branch_code",
272
+ field=models.SmallIntegerField(db_index=True, default=1, db_default=1),
273
+ ),
274
+ migrations.AddField(
275
+ model_name="feature",
276
+ name="_branch_code",
277
+ field=models.SmallIntegerField(db_index=True, default=1, db_default=1),
278
+ ),
279
+ migrations.AddField(
280
+ model_name="featureset",
281
+ name="_branch_code",
282
+ field=models.SmallIntegerField(db_index=True, default=1, db_default=1),
283
+ ),
284
+ migrations.AddField(
285
+ model_name="param",
286
+ name="_branch_code",
287
+ field=models.SmallIntegerField(db_index=True, default=1, db_default=1),
288
+ ),
289
+ migrations.AddField(
290
+ model_name="run",
291
+ name="_branch_code",
292
+ field=models.SmallIntegerField(db_index=True, default=1, db_default=1),
293
+ ),
294
+ migrations.AddField(
295
+ model_name="storage",
296
+ name="_branch_code",
297
+ field=models.SmallIntegerField(db_index=True, default=1, db_default=1),
298
+ ),
299
+ migrations.AddField(
300
+ model_name="transform",
301
+ name="_branch_code",
302
+ field=models.SmallIntegerField(db_index=True, default=1, db_default=1),
303
+ ),
304
+ migrations.AddField(
305
+ model_name="ulabel",
306
+ name="_branch_code",
307
+ field=models.SmallIntegerField(db_index=True, default=1, db_default=1),
308
+ ),
309
+ migrations.AddField(
310
+ model_name="user",
311
+ name="_branch_code",
312
+ field=models.SmallIntegerField(db_index=True, default=1, db_default=1),
313
+ ),
314
+ # fix dtype values
315
+ migrations.RunSQL(
316
+ sql="""
317
+ UPDATE lamindb_feature
318
+ SET dtype = 'num'
319
+ WHERE dtype = 'number'
320
+ """
321
+ ),
322
+ migrations.RunSQL(
323
+ sql="""
324
+ UPDATE lamindb_featureset
325
+ SET dtype = 'num'
326
+ WHERE dtype = 'number'
327
+ """
328
+ ),
329
+ # an aux field on Record
330
+ migrations.AddField(
331
+ model_name="artifact",
332
+ name="aux",
333
+ field=models.JSONField(default=None, db_default=None, null=True),
334
+ ),
335
+ migrations.AddField(
336
+ model_name="collection",
337
+ name="aux",
338
+ field=models.JSONField(default=None, db_default=None, null=True),
339
+ ),
340
+ migrations.AddField(
341
+ model_name="feature",
342
+ name="aux",
343
+ field=models.JSONField(default=None, db_default=None, null=True),
344
+ ),
345
+ migrations.AddField(
346
+ model_name="featureset",
347
+ name="aux",
348
+ field=models.JSONField(default=None, db_default=None, null=True),
349
+ ),
350
+ migrations.AddField(
351
+ model_name="param",
352
+ name="aux",
353
+ field=models.JSONField(default=None, db_default=None, null=True),
354
+ ),
355
+ migrations.AddField(
356
+ model_name="run",
357
+ name="aux",
358
+ field=models.JSONField(default=None, db_default=None, null=True),
359
+ ),
360
+ migrations.AddField(
361
+ model_name="storage",
362
+ name="aux",
363
+ field=models.JSONField(default=None, db_default=None, null=True),
364
+ ),
365
+ migrations.AddField(
366
+ model_name="transform",
367
+ name="aux",
368
+ field=models.JSONField(default=None, db_default=None, null=True),
369
+ ),
370
+ migrations.AddField(
371
+ model_name="ulabel",
372
+ name="aux",
373
+ field=models.JSONField(default=None, db_default=None, null=True),
374
+ ),
375
+ migrations.AddField(
376
+ model_name="user",
377
+ name="aux",
378
+ field=models.JSONField(default=None, db_default=None, null=True),
379
+ ),
380
+ migrations.RenameField(
381
+ model_name="run",
382
+ old_name="is_consecutive",
383
+ new_name="_is_consecutive",
384
+ ),
385
+ migrations.AddField(
386
+ model_name="run",
387
+ name="_status_code",
388
+ field=models.SmallIntegerField(db_index=True, default=0),
389
+ ),
390
+ migrations.AddField(
391
+ model_name="transform",
392
+ name="_template",
393
+ field=lamindb.base.fields.ForeignKey(
394
+ blank=True,
395
+ default=None,
396
+ null=True,
397
+ on_delete=django.db.models.deletion.PROTECT,
398
+ related_name="_derived_from",
399
+ to="lamindb.transform",
400
+ ),
401
+ ),
402
+ migrations.RenameField(
403
+ model_name="artifact",
404
+ old_name="type",
405
+ new_name="kind",
406
+ ),
407
+ migrations.RenameField(
408
+ model_name="artifact",
409
+ old_name="_accessor",
410
+ new_name="otype",
411
+ ),
412
+ migrations.AddField(
413
+ model_name="run",
414
+ name="_logfile",
415
+ field=lamindb.base.fields.ForeignKey(
416
+ blank=True,
417
+ default=None,
418
+ null=True,
419
+ on_delete=django.db.models.deletion.PROTECT,
420
+ related_name="_logfile_of",
421
+ to="lamindb.artifact",
422
+ ),
423
+ ),
424
+ # unique constraint on hash
425
+ migrations.AddField(
426
+ model_name="featurevalue",
427
+ name="hash",
428
+ field=lamindb.base.fields.CharField(
429
+ blank=True, db_index=True, default=None, max_length=22, null=True
430
+ ),
431
+ ),
432
+ migrations.AddField(
433
+ model_name="paramvalue",
434
+ name="hash",
435
+ field=lamindb.base.fields.CharField(
436
+ blank=True, db_index=True, default=None, max_length=22, null=True
437
+ ),
438
+ ),
439
+ migrations.RunPython(populate_hashes),
440
+ migrations.AddConstraint(
441
+ model_name="featurevalue",
442
+ constraint=models.UniqueConstraint(
443
+ condition=models.Q(("hash__isnull", True)),
444
+ fields=("feature", "value"),
445
+ name="unique_simple_feature_value",
446
+ ),
447
+ ),
448
+ migrations.AddConstraint(
449
+ model_name="featurevalue",
450
+ constraint=models.UniqueConstraint(
451
+ condition=models.Q(("hash__isnull", False)),
452
+ fields=("feature", "hash"),
453
+ name="unique_complex_feature_value",
454
+ ),
455
+ ),
456
+ migrations.AddConstraint(
457
+ model_name="paramvalue",
458
+ constraint=models.UniqueConstraint(
459
+ condition=models.Q(("hash__isnull", True)),
460
+ fields=("param", "value"),
461
+ name="unique_simple_param_value",
462
+ ),
463
+ ),
464
+ migrations.AddConstraint(
465
+ model_name="paramvalue",
466
+ constraint=models.UniqueConstraint(
467
+ condition=models.Q(("hash__isnull", False)),
468
+ fields=("param", "hash"),
469
+ name="unique_complex_param_value",
470
+ ),
471
+ ),
472
+ # add _curator field
473
+ migrations.AddField(
474
+ model_name="artifact",
475
+ name="_curator",
476
+ field=models.JSONField(default=None, db_default=None, null=True),
477
+ ),
478
+ # add _expect_many fields
479
+ migrations.AddField(
480
+ model_name="feature",
481
+ name="_expect_many",
482
+ field=models.BooleanField(default=True, db_default=True),
483
+ ),
484
+ migrations.AddField(
485
+ model_name="param",
486
+ name="_expect_many",
487
+ field=models.BooleanField(default=False, db_default=False),
488
+ ),
489
+ # remove transform field
490
+ migrations.RemoveField(
491
+ model_name="artifact",
492
+ name="transform",
493
+ ),
494
+ migrations.RemoveField(
495
+ model_name="collection",
496
+ name="transform",
497
+ ),
498
+ # richer link tables
499
+ migrations.CreateModel(
500
+ name="TransformULabel",
501
+ fields=[
502
+ (
503
+ "created_at",
504
+ lamindb.base.fields.DateTimeField(auto_now_add=True, db_index=True),
505
+ ),
506
+ ("id", models.BigAutoField(primary_key=True, serialize=False)),
507
+ (
508
+ "created_by",
509
+ lamindb.base.fields.ForeignKey(
510
+ blank=True,
511
+ default=lamindb.base.users.current_user_id,
512
+ on_delete=django.db.models.deletion.PROTECT,
513
+ related_name="+",
514
+ to="lamindb.user",
515
+ ),
516
+ ),
517
+ (
518
+ "run",
519
+ lamindb.base.fields.ForeignKey(
520
+ blank=True,
521
+ default=lamindb.models.current_run,
522
+ null=True,
523
+ on_delete=django.db.models.deletion.PROTECT,
524
+ related_name="+",
525
+ to="lamindb.run",
526
+ ),
527
+ ),
528
+ (
529
+ "transform",
530
+ lamindb.base.fields.ForeignKey(
531
+ blank=True,
532
+ on_delete=django.db.models.deletion.CASCADE,
533
+ related_name="links_ulabel",
534
+ to="lamindb.transform",
535
+ ),
536
+ ),
537
+ (
538
+ "ulabel",
539
+ lamindb.base.fields.ForeignKey(
540
+ blank=True,
541
+ on_delete=django.db.models.deletion.PROTECT,
542
+ related_name="links_transform",
543
+ to="lamindb.ulabel",
544
+ ),
545
+ ),
546
+ ],
547
+ options={
548
+ "unique_together": {("transform", "ulabel")},
549
+ },
550
+ bases=(lamindb.models.LinkORM, models.Model),
551
+ ),
552
+ migrations.RunSQL(
553
+ sql="""
554
+ INSERT INTO lamindb_transformulabel (transform_id, ulabel_id, created_at, created_by_id)
555
+ SELECT
556
+ transform_id,
557
+ ulabel_id,
558
+ CURRENT_TIMESTAMP, -- Sets current timestamp for created_at
559
+ 1 -- Sets default user ID 1 for created_by_id
560
+ FROM lamindb_transform_ulabels;
561
+ """
562
+ ),
563
+ migrations.RemoveField(
564
+ model_name="transform",
565
+ name="ulabels",
566
+ ),
567
+ migrations.AddField(
568
+ model_name="transform",
569
+ name="ulabels",
570
+ field=models.ManyToManyField(
571
+ to="lamindb.ulabel",
572
+ through="lamindb.TransformULabel",
573
+ related_name="transforms",
574
+ ),
575
+ ),
576
+ migrations.AddField(
577
+ model_name="artifactparamvalue",
578
+ name="created_at",
579
+ field=lamindb.base.fields.DateTimeField(
580
+ auto_now_add=True, db_index=True, default=django.utils.timezone.now
581
+ ),
582
+ preserve_default=False,
583
+ ),
584
+ migrations.AddField(
585
+ model_name="artifactparamvalue",
586
+ name="created_by",
587
+ field=lamindb.base.fields.ForeignKey(
588
+ blank=True,
589
+ default=lamindb.base.users.current_user_id,
590
+ on_delete=django.db.models.deletion.PROTECT,
591
+ related_name="+",
592
+ to="lamindb.user",
593
+ ),
594
+ ),
595
+ migrations.AddField(
596
+ model_name="artifactparamvalue",
597
+ name="run",
598
+ field=lamindb.base.fields.ForeignKey(
599
+ blank=True,
600
+ default=lamindb.models.current_run,
601
+ null=True,
602
+ on_delete=django.db.models.deletion.PROTECT,
603
+ related_name="+",
604
+ to="lamindb.run",
605
+ ),
606
+ ),
607
+ migrations.AddField(
608
+ model_name="runparamvalue",
609
+ name="created_at",
610
+ field=lamindb.base.fields.DateTimeField(
611
+ auto_now_add=True, db_index=True, default=django.utils.timezone.now
612
+ ),
613
+ preserve_default=False,
614
+ ),
615
+ migrations.AddField(
616
+ model_name="runparamvalue",
617
+ name="created_by",
618
+ field=lamindb.base.fields.ForeignKey(
619
+ blank=True,
620
+ default=lamindb.base.users.current_user_id,
621
+ on_delete=django.db.models.deletion.PROTECT,
622
+ related_name="+",
623
+ to="lamindb.user",
624
+ ),
625
+ ),
626
+ migrations.AddField(
627
+ model_name="ulabel",
628
+ name="is_concept",
629
+ field=lamindb.base.fields.BooleanField(
630
+ blank=True,
631
+ default=False,
632
+ db_default=False,
633
+ ),
634
+ ),
635
+ migrations.RenameField(
636
+ model_name="run",
637
+ old_name="parent",
638
+ new_name="initiated_by_run",
639
+ ),
640
+ migrations.AlterField(
641
+ model_name="run",
642
+ name="initiated_by_run",
643
+ field=lamindb.base.fields.ForeignKey(
644
+ blank=True,
645
+ default=None,
646
+ null=True,
647
+ on_delete=django.db.models.deletion.CASCADE,
648
+ related_name="initiated_runs",
649
+ to="lamindb.run",
650
+ ),
651
+ ),
652
+ # create and set _overwrite_versions
653
+ migrations.AddField(
654
+ model_name="artifact",
655
+ name="_overwrite_versions",
656
+ field=lamindb.base.fields.BooleanField(blank=True, default=None, null=True),
657
+ ),
658
+ migrations.RunSQL(
659
+ sql="""
660
+ UPDATE lamindb_artifact
661
+ SET _overwrite_versions = CASE
662
+ WHEN n_objects IS NOT NULL THEN TRUE
663
+ ELSE FALSE
664
+ END;
665
+ """
666
+ ),
667
+ # rename n_files to n_objects
668
+ migrations.RenameField(
669
+ model_name="artifact",
670
+ old_name="n_objects",
671
+ new_name="n_files",
672
+ ),
673
+ # let feature value and paramvalue inherit from Record
674
+ migrations.AddField(
675
+ model_name="featurevalue",
676
+ name="_branch_code",
677
+ field=models.SmallIntegerField(db_default=1, db_index=True, default=1),
678
+ ),
679
+ migrations.AddField(
680
+ model_name="featurevalue",
681
+ name="aux",
682
+ field=models.JSONField(db_default=None, default=None, null=True),
683
+ ),
684
+ migrations.AddField(
685
+ model_name="paramvalue",
686
+ name="_branch_code",
687
+ field=models.SmallIntegerField(db_default=1, db_index=True, default=1),
688
+ ),
689
+ migrations.AddField(
690
+ model_name="paramvalue",
691
+ name="aux",
692
+ field=models.JSONField(db_default=None, default=None, null=True),
693
+ ),
694
+ migrations.AddField(
695
+ model_name="run",
696
+ name="name",
697
+ field=lamindb.base.fields.CharField(
698
+ blank=True, default=None, max_length=150, null=True
699
+ ),
700
+ ),
701
+ migrations.AlterField(
702
+ model_name="space",
703
+ name="created_at",
704
+ field=lamindb.base.fields.DateTimeField(auto_now_add=True, db_index=True),
705
+ ),
706
+ migrations.AddField(
707
+ model_name="param",
708
+ name="type",
709
+ field=lamindb.base.fields.CharField(
710
+ blank=True, db_index=True, default=None, max_length=100, null=True
711
+ ),
712
+ ),
713
+ migrations.AddField(
714
+ model_name="feature",
715
+ name="type",
716
+ field=lamindb.base.fields.CharField(
717
+ blank=True, db_index=True, default=None, max_length=100, null=True
718
+ ),
719
+ ),
720
+ migrations.RemoveField(
721
+ model_name="feature",
722
+ name="_previous_runs",
723
+ ),
724
+ migrations.RemoveField(
725
+ model_name="param",
726
+ name="_previous_runs",
727
+ ),
728
+ migrations.RemoveField(
729
+ model_name="storage",
730
+ name="_previous_runs",
731
+ ),
732
+ migrations.RemoveField(
733
+ model_name="ulabel",
734
+ name="_previous_runs",
735
+ ),
736
+ migrations.AlterField(
737
+ model_name="artifact",
738
+ name="_overwrite_versions",
739
+ field=lamindb.base.fields.BooleanField(blank=True, default=None),
740
+ ),
741
+ ]