danylokhodus commited on
Commit
8ad9904
·
1 Parent(s): 4a2c1e9

fix: resolve disk I/O errors and support large images by increasing field limits and optimizing SQLite settings

Browse files
FlowAPI.Infrastructure/Data/AppDbContext.cs CHANGED
@@ -48,14 +48,14 @@ namespace FlowAPI.Infrastructure.Data
48
  modelBuilder.Entity<TaskNode>(entity =>
49
  {
50
  entity.HasKey(e => e.Id);
51
- entity.Property(e => e.Label).IsRequired().HasMaxLength(500);
52
  entity.Property(e => e.State)
53
  .HasConversion<string>()
54
  .HasDefaultValue(NodeState.Pending);
55
  entity.Property(e => e.Type).HasMaxLength(100).HasDefaultValue("sketch");
56
- entity.Property(e => e.Decision).HasMaxLength(10000);
57
- entity.Property(e => e.Data); // Explicitly include Data field without tight limit
58
- entity.Property(e => e.Description).HasMaxLength(5000);
59
  entity.Property(e => e.Color).HasMaxLength(100);
60
 
61
  entity.HasOne(e => e.Graph)
 
48
  modelBuilder.Entity<TaskNode>(entity =>
49
  {
50
  entity.HasKey(e => e.Id);
51
+ entity.Property(e => e.Label).IsRequired().HasMaxLength(1000);
52
  entity.Property(e => e.State)
53
  .HasConversion<string>()
54
  .HasDefaultValue(NodeState.Pending);
55
  entity.Property(e => e.Type).HasMaxLength(100).HasDefaultValue("sketch");
56
+ entity.Property(e => e.Decision).HasMaxLength(1000000);
57
+ entity.Property(e => e.Data).HasMaxLength(10000000); // Support up to ~10MB images
58
+ entity.Property(e => e.Description).HasMaxLength(10000);
59
  entity.Property(e => e.Color).HasMaxLength(100);
60
 
61
  entity.HasOne(e => e.Graph)
FlowAPI.Infrastructure/Migrations/20260521164426_MassiveIncreaseInFieldLimits.Designer.cs ADDED
@@ -0,0 +1,449 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // <auto-generated />
2
+ using System;
3
+ using FlowAPI.Infrastructure.Data;
4
+ using Microsoft.EntityFrameworkCore;
5
+ using Microsoft.EntityFrameworkCore.Infrastructure;
6
+ using Microsoft.EntityFrameworkCore.Migrations;
7
+ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
8
+
9
+ #nullable disable
10
+
11
+ namespace FlowAPI.Infrastructure.Migrations
12
+ {
13
+ [DbContext(typeof(AppDbContext))]
14
+ [Migration("20260521164426_MassiveIncreaseInFieldLimits")]
15
+ partial class MassiveIncreaseInFieldLimits
16
+ {
17
+ /// <inheritdoc />
18
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
19
+ {
20
+ #pragma warning disable 612, 618
21
+ modelBuilder.HasAnnotation("ProductVersion", "10.0.8");
22
+
23
+ modelBuilder.Entity("FlowAPI.Domain.Entities.Achievement", b =>
24
+ {
25
+ b.Property<Guid>("Id")
26
+ .ValueGeneratedOnAdd()
27
+ .HasColumnType("TEXT");
28
+
29
+ b.Property<string>("Category")
30
+ .IsRequired()
31
+ .HasMaxLength(100)
32
+ .HasColumnType("TEXT");
33
+
34
+ b.Property<string>("Description")
35
+ .IsRequired()
36
+ .HasColumnType("TEXT");
37
+
38
+ b.Property<string>("IconUrl")
39
+ .IsRequired()
40
+ .HasColumnType("TEXT");
41
+
42
+ b.Property<int>("RewardPoints")
43
+ .HasColumnType("INTEGER");
44
+
45
+ b.Property<int>("TargetValue")
46
+ .HasColumnType("INTEGER");
47
+
48
+ b.Property<string>("Title")
49
+ .IsRequired()
50
+ .HasMaxLength(200)
51
+ .HasColumnType("TEXT");
52
+
53
+ b.Property<string>("TriggerEventName")
54
+ .IsRequired()
55
+ .HasMaxLength(100)
56
+ .HasColumnType("TEXT");
57
+
58
+ b.Property<int>("Type")
59
+ .HasColumnType("INTEGER");
60
+
61
+ b.HasKey("Id");
62
+
63
+ b.ToTable("Achievements");
64
+ });
65
+
66
+ modelBuilder.Entity("FlowAPI.Domain.Entities.Edge", b =>
67
+ {
68
+ b.Property<Guid>("Id")
69
+ .ValueGeneratedOnAdd()
70
+ .HasColumnType("TEXT");
71
+
72
+ b.Property<string>("Condition")
73
+ .IsRequired()
74
+ .HasMaxLength(500)
75
+ .HasColumnType("TEXT");
76
+
77
+ b.Property<Guid>("FromNodeId")
78
+ .HasColumnType("TEXT");
79
+
80
+ b.Property<Guid>("GraphId")
81
+ .HasColumnType("TEXT");
82
+
83
+ b.Property<Guid>("ToNodeId")
84
+ .HasColumnType("TEXT");
85
+
86
+ b.HasKey("Id");
87
+
88
+ b.HasIndex("FromNodeId");
89
+
90
+ b.HasIndex("GraphId");
91
+
92
+ b.HasIndex("ToNodeId");
93
+
94
+ b.ToTable("Edges");
95
+ });
96
+
97
+ modelBuilder.Entity("FlowAPI.Domain.Entities.Graph", b =>
98
+ {
99
+ b.Property<Guid>("Id")
100
+ .ValueGeneratedOnAdd()
101
+ .HasColumnType("TEXT");
102
+
103
+ b.Property<DateTime>("CreatedAt")
104
+ .HasColumnType("TEXT");
105
+
106
+ b.Property<string>("Description")
107
+ .HasMaxLength(1000)
108
+ .HasColumnType("TEXT");
109
+
110
+ b.Property<string>("Title")
111
+ .IsRequired()
112
+ .HasMaxLength(200)
113
+ .HasColumnType("TEXT");
114
+
115
+ b.Property<DateTime>("UpdatedAt")
116
+ .HasColumnType("TEXT");
117
+
118
+ b.Property<Guid>("UserId")
119
+ .HasColumnType("TEXT");
120
+
121
+ b.HasKey("Id");
122
+
123
+ b.HasIndex("UserId");
124
+
125
+ b.ToTable("Graphs");
126
+ });
127
+
128
+ modelBuilder.Entity("FlowAPI.Domain.Entities.HabitRecord", b =>
129
+ {
130
+ b.Property<Guid>("Id")
131
+ .ValueGeneratedOnAdd()
132
+ .HasColumnType("TEXT");
133
+
134
+ b.Property<DateTime>("CheckedDate")
135
+ .HasColumnType("TEXT");
136
+
137
+ b.Property<string>("HabitName")
138
+ .IsRequired()
139
+ .HasMaxLength(100)
140
+ .HasColumnType("TEXT");
141
+
142
+ b.Property<int>("StreakCount")
143
+ .HasColumnType("INTEGER");
144
+
145
+ b.Property<Guid>("UserId")
146
+ .HasColumnType("TEXT");
147
+
148
+ b.HasKey("Id");
149
+
150
+ b.HasIndex("UserId");
151
+
152
+ b.ToTable("HabitRecords");
153
+ });
154
+
155
+ modelBuilder.Entity("FlowAPI.Domain.Entities.SharedGraph", b =>
156
+ {
157
+ b.Property<Guid>("Id")
158
+ .ValueGeneratedOnAdd()
159
+ .HasColumnType("TEXT");
160
+
161
+ b.Property<DateTime>("CreatedAt")
162
+ .HasColumnType("TEXT");
163
+
164
+ b.Property<Guid>("GraphId")
165
+ .HasColumnType("TEXT");
166
+
167
+ b.Property<string>("Permission")
168
+ .IsRequired()
169
+ .ValueGeneratedOnAdd()
170
+ .HasMaxLength(50)
171
+ .HasColumnType("TEXT")
172
+ .HasDefaultValue("Read");
173
+
174
+ b.Property<Guid>("SharedWithUserId")
175
+ .HasColumnType("TEXT");
176
+
177
+ b.HasKey("Id");
178
+
179
+ b.HasIndex("SharedWithUserId");
180
+
181
+ b.HasIndex("GraphId", "SharedWithUserId")
182
+ .IsUnique();
183
+
184
+ b.ToTable("SharedGraphs");
185
+ });
186
+
187
+ modelBuilder.Entity("FlowAPI.Domain.Entities.TaskNode", b =>
188
+ {
189
+ b.Property<Guid>("Id")
190
+ .ValueGeneratedOnAdd()
191
+ .HasColumnType("TEXT");
192
+
193
+ b.Property<string>("Color")
194
+ .HasMaxLength(100)
195
+ .HasColumnType("TEXT");
196
+
197
+ b.Property<DateTime>("CreatedAt")
198
+ .HasColumnType("TEXT");
199
+
200
+ b.Property<string>("Data")
201
+ .HasMaxLength(10000000)
202
+ .HasColumnType("TEXT");
203
+
204
+ b.Property<string>("Decision")
205
+ .HasMaxLength(1000000)
206
+ .HasColumnType("TEXT");
207
+
208
+ b.Property<string>("Description")
209
+ .HasMaxLength(10000)
210
+ .HasColumnType("TEXT");
211
+
212
+ b.Property<Guid>("GraphId")
213
+ .HasColumnType("TEXT");
214
+
215
+ b.Property<double?>("Height")
216
+ .HasColumnType("REAL");
217
+
218
+ b.Property<bool>("IsPinned")
219
+ .HasColumnType("INTEGER");
220
+
221
+ b.Property<string>("Label")
222
+ .IsRequired()
223
+ .HasMaxLength(1000)
224
+ .HasColumnType("TEXT");
225
+
226
+ b.Property<double>("PosX")
227
+ .HasColumnType("REAL");
228
+
229
+ b.Property<double>("PosY")
230
+ .HasColumnType("REAL");
231
+
232
+ b.Property<string>("State")
233
+ .IsRequired()
234
+ .ValueGeneratedOnAdd()
235
+ .HasColumnType("TEXT")
236
+ .HasDefaultValue("Pending");
237
+
238
+ b.Property<string>("Type")
239
+ .IsRequired()
240
+ .ValueGeneratedOnAdd()
241
+ .HasMaxLength(100)
242
+ .HasColumnType("TEXT")
243
+ .HasDefaultValue("sketch");
244
+
245
+ b.Property<double?>("Width")
246
+ .HasColumnType("REAL");
247
+
248
+ b.HasKey("Id");
249
+
250
+ b.HasIndex("GraphId");
251
+
252
+ b.ToTable("TaskNodes");
253
+ });
254
+
255
+ modelBuilder.Entity("FlowAPI.Domain.Entities.User", b =>
256
+ {
257
+ b.Property<Guid>("Id")
258
+ .ValueGeneratedOnAdd()
259
+ .HasColumnType("TEXT");
260
+
261
+ b.Property<string>("AvatarUrl")
262
+ .HasColumnType("TEXT");
263
+
264
+ b.Property<DateTime>("CreatedAt")
265
+ .HasColumnType("TEXT");
266
+
267
+ b.Property<string>("DisplayName")
268
+ .IsRequired()
269
+ .HasMaxLength(100)
270
+ .HasColumnType("TEXT");
271
+
272
+ b.Property<string>("Email")
273
+ .IsRequired()
274
+ .HasMaxLength(256)
275
+ .HasColumnType("TEXT");
276
+
277
+ b.Property<bool>("IsPremium")
278
+ .HasColumnType("INTEGER");
279
+
280
+ b.Property<string>("PasswordHash")
281
+ .IsRequired()
282
+ .HasColumnType("TEXT");
283
+
284
+ b.HasKey("Id");
285
+
286
+ b.HasIndex("Email")
287
+ .IsUnique();
288
+
289
+ b.ToTable("Users");
290
+ });
291
+
292
+ modelBuilder.Entity("FlowAPI.Domain.Entities.UserAchievement", b =>
293
+ {
294
+ b.Property<Guid>("Id")
295
+ .ValueGeneratedOnAdd()
296
+ .HasColumnType("TEXT");
297
+
298
+ b.Property<Guid>("AchievementId")
299
+ .HasColumnType("TEXT");
300
+
301
+ b.Property<int>("CurrentValue")
302
+ .HasColumnType("INTEGER");
303
+
304
+ b.Property<bool>("IsUnlocked")
305
+ .HasColumnType("INTEGER");
306
+
307
+ b.Property<DateTime?>("UnlockedAt")
308
+ .HasColumnType("TEXT");
309
+
310
+ b.Property<Guid>("UserId")
311
+ .HasColumnType("TEXT");
312
+
313
+ b.HasKey("Id");
314
+
315
+ b.HasIndex("AchievementId");
316
+
317
+ b.HasIndex("UserId");
318
+
319
+ b.ToTable("UserAchievements");
320
+ });
321
+
322
+ modelBuilder.Entity("FlowAPI.Domain.Entities.Edge", b =>
323
+ {
324
+ b.HasOne("FlowAPI.Domain.Entities.TaskNode", "FromNode")
325
+ .WithMany("OutgoingEdges")
326
+ .HasForeignKey("FromNodeId")
327
+ .OnDelete(DeleteBehavior.Cascade)
328
+ .IsRequired();
329
+
330
+ b.HasOne("FlowAPI.Domain.Entities.Graph", "Graph")
331
+ .WithMany("Edges")
332
+ .HasForeignKey("GraphId")
333
+ .OnDelete(DeleteBehavior.Cascade)
334
+ .IsRequired();
335
+
336
+ b.HasOne("FlowAPI.Domain.Entities.TaskNode", "ToNode")
337
+ .WithMany("IncomingEdges")
338
+ .HasForeignKey("ToNodeId")
339
+ .OnDelete(DeleteBehavior.Cascade)
340
+ .IsRequired();
341
+
342
+ b.Navigation("FromNode");
343
+
344
+ b.Navigation("Graph");
345
+
346
+ b.Navigation("ToNode");
347
+ });
348
+
349
+ modelBuilder.Entity("FlowAPI.Domain.Entities.Graph", b =>
350
+ {
351
+ b.HasOne("FlowAPI.Domain.Entities.User", "User")
352
+ .WithMany("Graphs")
353
+ .HasForeignKey("UserId")
354
+ .OnDelete(DeleteBehavior.Cascade)
355
+ .IsRequired();
356
+
357
+ b.Navigation("User");
358
+ });
359
+
360
+ modelBuilder.Entity("FlowAPI.Domain.Entities.HabitRecord", b =>
361
+ {
362
+ b.HasOne("FlowAPI.Domain.Entities.User", "User")
363
+ .WithMany("HabitRecords")
364
+ .HasForeignKey("UserId")
365
+ .OnDelete(DeleteBehavior.Cascade)
366
+ .IsRequired();
367
+
368
+ b.Navigation("User");
369
+ });
370
+
371
+ modelBuilder.Entity("FlowAPI.Domain.Entities.SharedGraph", b =>
372
+ {
373
+ b.HasOne("FlowAPI.Domain.Entities.Graph", "Graph")
374
+ .WithMany("SharedGraphs")
375
+ .HasForeignKey("GraphId")
376
+ .OnDelete(DeleteBehavior.Cascade)
377
+ .IsRequired();
378
+
379
+ b.HasOne("FlowAPI.Domain.Entities.User", "SharedWithUser")
380
+ .WithMany("SharedGraphs")
381
+ .HasForeignKey("SharedWithUserId")
382
+ .OnDelete(DeleteBehavior.Cascade)
383
+ .IsRequired();
384
+
385
+ b.Navigation("Graph");
386
+
387
+ b.Navigation("SharedWithUser");
388
+ });
389
+
390
+ modelBuilder.Entity("FlowAPI.Domain.Entities.TaskNode", b =>
391
+ {
392
+ b.HasOne("FlowAPI.Domain.Entities.Graph", "Graph")
393
+ .WithMany("Nodes")
394
+ .HasForeignKey("GraphId")
395
+ .OnDelete(DeleteBehavior.Cascade)
396
+ .IsRequired();
397
+
398
+ b.Navigation("Graph");
399
+ });
400
+
401
+ modelBuilder.Entity("FlowAPI.Domain.Entities.UserAchievement", b =>
402
+ {
403
+ b.HasOne("FlowAPI.Domain.Entities.Achievement", "Achievement")
404
+ .WithMany()
405
+ .HasForeignKey("AchievementId")
406
+ .OnDelete(DeleteBehavior.Cascade)
407
+ .IsRequired();
408
+
409
+ b.HasOne("FlowAPI.Domain.Entities.User", "User")
410
+ .WithMany("UserAchievements")
411
+ .HasForeignKey("UserId")
412
+ .OnDelete(DeleteBehavior.Cascade)
413
+ .IsRequired();
414
+
415
+ b.Navigation("Achievement");
416
+
417
+ b.Navigation("User");
418
+ });
419
+
420
+ modelBuilder.Entity("FlowAPI.Domain.Entities.Graph", b =>
421
+ {
422
+ b.Navigation("Edges");
423
+
424
+ b.Navigation("Nodes");
425
+
426
+ b.Navigation("SharedGraphs");
427
+ });
428
+
429
+ modelBuilder.Entity("FlowAPI.Domain.Entities.TaskNode", b =>
430
+ {
431
+ b.Navigation("IncomingEdges");
432
+
433
+ b.Navigation("OutgoingEdges");
434
+ });
435
+
436
+ modelBuilder.Entity("FlowAPI.Domain.Entities.User", b =>
437
+ {
438
+ b.Navigation("Graphs");
439
+
440
+ b.Navigation("HabitRecords");
441
+
442
+ b.Navigation("SharedGraphs");
443
+
444
+ b.Navigation("UserAchievements");
445
+ });
446
+ #pragma warning restore 612, 618
447
+ }
448
+ }
449
+ }
FlowAPI.Infrastructure/Migrations/20260521164426_MassiveIncreaseInFieldLimits.cs ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ using Microsoft.EntityFrameworkCore.Migrations;
2
+
3
+ #nullable disable
4
+
5
+ namespace FlowAPI.Infrastructure.Migrations
6
+ {
7
+ /// <inheritdoc />
8
+ public partial class MassiveIncreaseInFieldLimits : Migration
9
+ {
10
+ /// <inheritdoc />
11
+ protected override void Up(MigrationBuilder migrationBuilder)
12
+ {
13
+
14
+ }
15
+
16
+ /// <inheritdoc />
17
+ protected override void Down(MigrationBuilder migrationBuilder)
18
+ {
19
+
20
+ }
21
+ }
22
+ }
FlowAPI.Infrastructure/Migrations/AppDbContextModelSnapshot.cs CHANGED
@@ -195,14 +195,15 @@ namespace FlowAPI.Infrastructure.Migrations
195
  .HasColumnType("TEXT");
196
 
197
  b.Property<string>("Data")
 
198
  .HasColumnType("TEXT");
199
 
200
  b.Property<string>("Decision")
201
- .HasMaxLength(10000)
202
  .HasColumnType("TEXT");
203
 
204
  b.Property<string>("Description")
205
- .HasMaxLength(5000)
206
  .HasColumnType("TEXT");
207
 
208
  b.Property<Guid>("GraphId")
@@ -216,7 +217,7 @@ namespace FlowAPI.Infrastructure.Migrations
216
 
217
  b.Property<string>("Label")
218
  .IsRequired()
219
- .HasMaxLength(500)
220
  .HasColumnType("TEXT");
221
 
222
  b.Property<double>("PosX")
 
195
  .HasColumnType("TEXT");
196
 
197
  b.Property<string>("Data")
198
+ .HasMaxLength(10000000)
199
  .HasColumnType("TEXT");
200
 
201
  b.Property<string>("Decision")
202
+ .HasMaxLength(1000000)
203
  .HasColumnType("TEXT");
204
 
205
  b.Property<string>("Description")
206
+ .HasMaxLength(10000)
207
  .HasColumnType("TEXT");
208
 
209
  b.Property<Guid>("GraphId")
 
217
 
218
  b.Property<string>("Label")
219
  .IsRequired()
220
+ .HasMaxLength(1000)
221
  .HasColumnType("TEXT");
222
 
223
  b.Property<double>("PosX")
FlowAPI/Program.cs CHANGED
@@ -136,11 +136,11 @@ namespace FlowAPI
136
 
137
  db.Database.Migrate();
138
 
139
- // Enable WAL mode for SQLite to improve performance and reliability in Docker/Cloud
140
  using (var command = db.Database.GetDbConnection().CreateCommand())
141
  {
142
  db.Database.OpenConnection();
143
- command.CommandText = "PRAGMA journal_mode=WAL; PRAGMA synchronous=NORMAL;";
144
  command.ExecuteNonQuery();
145
  }
146
 
 
136
 
137
  db.Database.Migrate();
138
 
139
+ // Set journal mode to TRUNCATE for better compatibility with Docker/Cloud filesystems while keeping performance
140
  using (var command = db.Database.GetDbConnection().CreateCommand())
141
  {
142
  db.Database.OpenConnection();
143
+ command.CommandText = "PRAGMA journal_mode=TRUNCATE; PRAGMA synchronous=NORMAL; PRAGMA locking_mode=NORMAL; PRAGMA temp_store=MEMORY;";
144
  command.ExecuteNonQuery();
145
  }
146
 
FlowAPI/appsettings.json CHANGED
@@ -8,7 +8,7 @@
8
  },
9
  "AllowedHosts": "*",
10
  "ConnectionStrings": {
11
- "DefaultConnection": "Data Source=taskflow.db"
12
  },
13
  "Jwt": {
14
  "Key": "TaskFlow_Secret_Key_For_JWT_Authentication_2026_!@#",
 
8
  },
9
  "AllowedHosts": "*",
10
  "ConnectionStrings": {
11
+ "DefaultConnection": "Data Source=taskflow.db;Cache=Shared;Busy Timeout=5000"
12
  },
13
  "Jwt": {
14
  "Key": "TaskFlow_Secret_Key_For_JWT_Authentication_2026_!@#",