Skip to content

docs(typed_sql): explain referential actions for foreign keys (#390)#399

Open
assassinaj602 wants to merge 5 commits into
google:masterfrom
assassinaj602:docs-referential-action
Open

docs(typed_sql): explain referential actions for foreign keys (#390)#399
assassinaj602 wants to merge 5 commits into
google:masterfrom
assassinaj602:docs-referential-action

Conversation

@assassinaj602

Copy link
Copy Markdown

Description

Adds comprehensive documentation for referential actions (onDelete, onUpdate) in the typed_sql foreign keys guide.

What Was Added

  • New "Referential actions" section after "Declaring foreign keys"
  • Reference table mapping each ReferentialAction enum value to its SQL keyword and behavior
  • Code example showing onDelete: ReferentialAction.cascade and onUpdate: ReferentialAction.noAction
  • Note that @ForeignKey supports the same parameters
  • Important warnings:
    • CASCADE deletes related rows without warning
    • SET NULL requires nullable columns
    • SET DEFAULT has MySQL/MariaDB limitations (copied from source docstrings)

Key Details from Source Code

  • noAction is the default (deferred to end-of-transaction)
  • restrict is checked immediately (different from noAction)
  • Accurate to actual implementation, not generic SQL descriptions

Testing

  • ✅ Documentation renders correctly in markdown
  • ✅ Examples use existing Book model from the doc
  • ✅ All callout blocks are properly formatted

Closes #390

The Summary class was counting errors with commentSpan differently from
the isFailed check, causing 'FAILED: 0 issues found' when errors existed
but without commentSpan.

Now both isFailed and errors count use the same consistent logic.

Fixes google#275
The hasMain getter only detected 'void main()', causing failures for:
- Future<void> main()
- main() (no return type)
- Future main()

Now uses regex to detect all main function declarations.

Fixes google#251
- Fix unnecessary null comparison in extractor.dart
- Remove unused variable in reporter.dart
- Fix unintended HTML in model.dart doc comments
@assassinaj602

Copy link
Copy Markdown
Author

@isoos can you kindly review my PR's

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document ReferentialAction on ForeignKey in doc/

1 participant