Fix FK constraint errors in batched file insertion
Generate file UUIDs upfront in checkFileInMemory() rather than deferring to Files.Create(). This ensures file_chunks and chunk_files records have valid FileID values when constructed during file processing, before the batch insert transaction. Root cause: For new files, file.ID was empty when building the fileChunks and chunkFiles slices. The ID was only generated later in Files.Create(), but by then the slices already had empty FileID values, causing FK constraint failures. Also adds PROCESS.md documenting the snapshot creation lifecycle, database transactions, and FK dependency ordering.
This commit is contained in:
10
CLAUDE.md
10
CLAUDE.md
@@ -10,6 +10,9 @@ Read the rules in AGENTS.md and follow them.
|
||||
corporate advertising for Anthropic and is therefore completely
|
||||
unacceptable in commit messages.
|
||||
|
||||
* NEVER use `git add -A`. Always add only the files you intentionally
|
||||
changed.
|
||||
|
||||
* Tests should always be run before committing code. No commits should be
|
||||
made that do not pass tests.
|
||||
|
||||
@@ -33,6 +36,9 @@ Read the rules in AGENTS.md and follow them.
|
||||
* When testing on a 2.5Gbit/s ethernet to an s3 server backed by 2000MB/sec SSD,
|
||||
estimate about 4 seconds per gigabyte of backup time.
|
||||
|
||||
* When running tests, don't run individual tests, or grep the output. run the entire test suite every time and read the full output.
|
||||
* When running tests, don't run individual tests, or grep the output. run
|
||||
the entire test suite every time and read the full output.
|
||||
|
||||
* When running tests, don't run individual tests, or try to grep the output. never run "go test". only ever run "make test" to run the full test suite, and examine the full output.
|
||||
* When running tests, don't run individual tests, or try to grep the output.
|
||||
never run "go test". only ever run "make test" to run the full test
|
||||
suite, and examine the full output.
|
||||
|
||||
Reference in New Issue
Block a user