-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: set column canNull default to false #195
Conversation
WalkthroughThe updates focus on enhancing data integrity and refining the development process. Adjustments include enforcing non-nullability in column definitions unless specified otherwise, cleaning up code by removing outdated comments, and improving debugging by logging SQL queries. Additionally, modifications in test fixtures and SQL generation logic reflect these stricter data constraints, while a plugin's property has been made mutable for flexible initialization. Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files ignored due to path filters (2)
core/dal-runtime/test/fixtures/modules/generate_codes/dal/structure/Foo.json
is excluded by:!**/*.json
core/dal-runtime/test/fixtures/modules/generate_codes/dal/structure/MultiPrimaryKey.json
is excluded by:!**/*.json
Files selected for processing (8)
- core/dal-decorator/src/model/ColumnModel.ts (1 hunks)
- core/dal-decorator/src/model/TableModel.ts (1 hunks)
- core/dal-runtime/test/DataSource.test.ts (1 hunks)
- core/dal-runtime/test/SqlGenerator.test.ts (1 hunks)
- core/dal-runtime/test/fixtures/modules/dal/Foo.ts (1 hunks)
- core/dal-runtime/test/fixtures/modules/generate_codes/dal/structure/Foo.sql (1 hunks)
- core/dal-runtime/test/fixtures/modules/generate_codes/dal/structure/MultiPrimaryKey.sql (1 hunks)
- plugin/dal/app.ts (1 hunks)
Files skipped from review due to trivial changes (1)
- core/dal-decorator/src/model/TableModel.ts
Additional comments: 8
core/dal-runtime/test/fixtures/modules/generate_codes/dal/structure/MultiPrimaryKey.sql (1)
- 4-4: The change to make the
name
columnNOT NULL
aligns with the PR's objective to enhance data integrity by enforcing non-nullability by default. This is a good practice, especially for a column that is also aUNIQUE KEY
.plugin/dal/app.ts (2)
- 10-10: Removing the
readonly
modifier fromdalTableEggPrototypeHook
and moving its instantiation toconfigWillLoad
increases flexibility. Ensure that the implications of this increased mutability are well understood and managed.- 19-19: Instantiating
dalTableEggPrototypeHook
inconfigWillLoad
allows for dynamic configuration before the application fully loads. This is a good practice for initializing components based on configuration that may not be available at construction time.core/dal-decorator/src/model/ColumnModel.ts (1)
- 55-55: The adjustment of the
canNull
default value tofalse
aligns with the PR's objective to enhance data integrity by enforcing non-nullability by default. This is a significant change that should be well-documented for future maintainers.core/dal-runtime/test/fixtures/modules/generate_codes/dal/structure/Foo.sql (1)
- 3-41: The comprehensive changes to make all columns
NOT NULL
in theegg_foo
table align with the PR's objective to enforce non-nullability by default, enhancing data integrity. This is a significant improvement in ensuring that the database schema is robust and consistent.core/dal-runtime/test/SqlGenerator.test.ts (1)
- 13-51: The updates to the test case to include
NOT NULL
constraints in column definitions align with the changes made to the schema and ensure that the tests accurately reflect the new behavior. This is a good practice to maintain consistency between the schema and its corresponding tests.core/dal-runtime/test/DataSource.test.ts (1)
- 32-32: Adding a
console.log
statement to output the SQL query before execution can be helpful for debugging purposes. However, consider using more sophisticated logging mechanisms or conditional logging based on the environment to manage verbosity in test outputs.core/dal-runtime/test/fixtures/modules/dal/Foo.ts (1)
- 166-167: Adding
canNull: true
to thetimestampColumn
is an explicit exception to the PR's general objective of enforcing non-nullability by default. It's important to document the rationale behind allowing null values for this specific column to ensure clarity for future maintainers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- core/dal-runtime/test/SqlGenerator.test.ts (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- core/dal-runtime/test/SqlGenerator.test.ts
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #195 +/- ##
==========================================
- Coverage 91.64% 91.60% -0.05%
==========================================
Files 276 276
Lines 6442 6431 -11
Branches 945 932 -13
==========================================
- Hits 5904 5891 -13
- Misses 538 540 +2 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
|
Checklist
npm test
passesAffected core subsystem(s)
Description of change
Summary by CodeRabbit
New Features
Bug Fixes
canNull
behavior in column definitions to enhance data integrity.NOT NULL
constraints, ensuring stricter data validation.Refactor
Tests