Conversation
|
To view this pull requests documentation preview, visit the following URL: docs.page/khuwn-soulutions/supabase_codegen~90 Documentation is deployed and generated using docs.page. |
📝 WalkthroughWalkthroughAdds a documentation site (new Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant CLI as CLI main
participant Init as initializeConfiguration
participant Migrate as checkMigration
participant FS as Filesystem
participant SupabaseCLI as "supabase CLI"
Note right of CLI: startup sequence triggers migrations
CLI->>Init: call initializeConfiguration()
Init->>Migrate: call checkMigration()
Migrate->>FS: list migrations dir & read SQL helpers
Migrate->>SupabaseCLI: query DB functions (spawn `supabase` or read)
SupabaseCLI-->>Migrate: stdout (existing functions)
Migrate->>Migrate: compute merged migration SQL
alt migration required
Migrate->>SupabaseCLI: run `supabase migrations new` (spawn)
SupabaseCLI-->>Migrate: stdout with created path
Migrate->>Migrate: extractPath(stdout)
Migrate->>FS: write computed SQL to migration file
Migrate->>CLI: log migration created
else no changes needed
Migrate->>CLI: log no changes
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
📜 Review details
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (10)
docs.jsondocs/environments/core.mdxdocs/environments/flutter.mdxdocs/environments/serverpod.mdxdocs/functions/rpc.mdxdocs/getting-started/index.mdxdocs/getting-started/migration-v3-to-v4.mdxdocs/index.mdxdocs/models/enums.mdxdocs/models/tables.mdx
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: jwelmac
Repo: Khuwn-Soulutions/supabase_codegen PR: 82
File: packages/supabase_codegen/lib/src/generator/generator.dart:6-7
Timestamp: 2025-12-08T19:48:00.427Z
Learning: In packages/supabase_codegen/lib/src/generator/generator.dart, the exports for rpcs/_rpcs.dart and utils/utils.dart are intended for use by other internal projects within the organization, not for external public consumption. Advanced external users who leverage these should read the internal documentation of the methods directly.
Learnt from: jwelmac
Repo: Khuwn-Soulutions/supabase_codegen PR: 82
File: packages/supabase_codegen/bin/sql/get_rpc_functions.dart:18-18
Timestamp: 2025-12-05T21:36:42.890Z
Learning: For supabase_codegen RPC function generation: the initial implementation (PR #82) is intentionally scoped to discover RPC functions only in the 'public' schema. Multi-schema support is planned for a subsequent PR.
📚 Learning: 2025-12-08T19:48:00.427Z
Learnt from: jwelmac
Repo: Khuwn-Soulutions/supabase_codegen PR: 82
File: packages/supabase_codegen/lib/src/generator/generator.dart:6-7
Timestamp: 2025-12-08T19:48:00.427Z
Learning: In packages/supabase_codegen/lib/src/generator/generator.dart, the exports for rpcs/_rpcs.dart and utils/utils.dart are intended for use by other internal projects within the organization, not for external public consumption. Advanced external users who leverage these should read the internal documentation of the methods directly.
Applied to files:
docs/models/enums.mdxdocs/environments/core.mdxdocs/functions/rpc.mdxdocs/getting-started/migration-v3-to-v4.mdxdocs/index.mdxdocs/environments/serverpod.mdxdocs/environments/flutter.mdxdocs/getting-started/index.mdx
📚 Learning: 2025-12-08T17:28:59.275Z
Learnt from: jwelmac
Repo: Khuwn-Soulutions/supabase_codegen PR: 82
File: packages/supabase_codegen_serverpod/example/example_server/test/integration/greeting_endpoint_test.dart:6-12
Timestamp: 2025-12-08T17:28:59.275Z
Learning: In packages/supabase_codegen_serverpod/example/example_server/test/integration/greeting_endpoint_test.dart, the integration tests are intentionally skipped by default (SKIP_GREETING_INTEGRATION_TEST with defaultValue: true) because the test setup is more extensive than needed for the project at this time. The run pipeline may be updated in the future to enable these tests if deemed necessary.
Applied to files:
docs/environments/core.mdxdocs/environments/serverpod.mdxdocs/environments/flutter.mdx
📚 Learning: 2025-12-05T21:36:42.890Z
Learnt from: jwelmac
Repo: Khuwn-Soulutions/supabase_codegen PR: 82
File: packages/supabase_codegen/bin/sql/get_rpc_functions.dart:18-18
Timestamp: 2025-12-05T21:36:42.890Z
Learning: For supabase_codegen RPC function generation: the initial implementation (PR #82) is intentionally scoped to discover RPC functions only in the 'public' schema. Multi-schema support is planned for a subsequent PR.
Applied to files:
docs/functions/rpc.mdxdocs/environments/serverpod.mdx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (12)
docs/environments/core.mdx (1)
1-99: LGTM! Clear and comprehensive Core Dart documentation.The documentation is well-structured with clear setup instructions, CLI usage examples, and multiple client configuration options. The version numbers are consistent with the migration guide, and the commands are accurate.
docs/getting-started/index.mdx (1)
1-78: LGTM! Excellent getting started guide.The documentation provides a clear, consistent introduction to Supabase Codegen with well-organized tabs for different environments. The version numbers and commands are accurate and consistent across all sections.
docs/environments/serverpod.mdx (1)
1-92: LGTM! Clear Serverpod integration documentation.The documentation provides comprehensive guidance for integrating Supabase Codegen with Serverpod, including helpful type mappings and important exclusion notes. The structure is logical and easy to follow.
docs/index.mdx (1)
1-55: LGTM! Welcoming and informative landing page.The documentation homepage effectively introduces Supabase Codegen with clear navigation to key resources and well-articulated use cases for different development scenarios.
docs/getting-started/migration-v3-to-v4.mdx (1)
1-68: LGTM! Comprehensive migration guide.The migration guide clearly documents breaking changes, new features, and provides step-by-step instructions for upgrading from v3 to v4. The warnings about dependency conflicts are particularly helpful.
docs/environments/flutter.mdx (4)
79-82: Verify the service client getters exist.Please confirm that
authClient,storageClient,functionsClient, andrealtimeClientgetters are exported and available in the supabase_codegen_flutter package.
58-58: Thesupabase_codegen_flutter:generate_typescommand is properly implemented and accessible. The executable is registered in pubspec.yaml and the correspondinggenerate_types.dartimplementation file exists in the bin directory.
66-67: TheloadClientFromEnv()function is confirmed to exist in the supabase_codegen_flutter package. It extracts configuration keys from the environment file (viaDotEnv().extractKeys()) and initializes the Supabase client, as documented.
90-93: The documentation example is accurate. ThequeryRows()method exists in theSupabaseTablebase class and is callable without parameters since bothqueryFnandlimitarguments are optional. The generated table classes inherit this method and the example correctly demonstrates its usage.docs/models/tables.mdx (3)
86-86: RemovecopyWithusage from documentation—the method is not generated for row classes.The
SupabaseDataRowbase class and generated row classes do not include acopyWithmethod. The update example at line 86 showingprofile.copyWith(bio: 'Senior Software Engineer')will fail at runtime. Either implementcopyWithgeneration for row classes or update the documentation to show alternative update patterns.Likely an incorrect or invalid review comment.
74-88: CRUD method examples are accurate and match the generated API.The
insert,querySingleRow, andupdatemethods exist with the correct signatures, and field constants are generated as staticconststrings (e.g.,ProfilesRow.emailField). The documentation examples correctly reflect the actual implementation, including the use ofcopyWithon row objects and the pattern of passing field constants to query/update operations.
34-64: The generated code example is accurate and matches the actual code generation implementation. All base classes, helper functions, and patterns documented are correctly implemented in the codebase.
There was a problem hiding this comment.
Actionable comments posted: 4
♻️ Duplicate comments (5)
docs/environments/flutter.mdx (1)
40-40: Verify the init command is registered as an executable.A previous review flagged that
dart run supabase_codegen_flutter:initmay not be available if theinitcommand isn't registered in the package'spubspec.yamlexecutables section. Confirm this command works as documented or update the documentation accordingly.#!/bin/bash # Verify init command is registered in supabase_codegen_flutter echo "=== Checking pubspec.yaml for init executable ===" if [ -f "packages/supabase_codegen_flutter/pubspec.yaml" ]; then echo "Found pubspec.yaml, checking executables section:" rg -A 10 "executables:" packages/supabase_codegen_flutter/pubspec.yaml || echo "No executables section found" echo -e "\n=== Checking if init.dart exists ===" if [ -f "packages/supabase_codegen_flutter/bin/init.dart" ]; then echo "✓ init.dart exists" else echo "✗ init.dart not found" fi else echo "✗ pubspec.yaml not found at expected location" fidocs/models/enums.mdx (1)
48-51: Fix code block formatting in CodeGroup.The code examples are compressed into single lines, which will render poorly. Each code block should use proper multi-line formatting.
🔎 Proposed fix for better formatting
<CodeGroup> - ```dart // By name final parsedRole = UserRole.values.byName("moderator"); ``` - ```dart // To string print(UserRole.admin.name); // "admin" ``` + ```dart + // By name + final parsedRole = UserRole.values.byName("moderator"); + ``` + ```dart + // To string + print(UserRole.admin.name); // "admin" + ``` </CodeGroup>docs/functions/rpc.mdx (3)
43-43: Fix code block syntax error.Line 43 has four backticks instead of three, which will break the code block rendering.
🔎 Proposed fix
-```` +``` </Accordion>
51-51: Fix code block syntax error.Line 51 has four backticks instead of three, which will break the code block rendering.
🔎 Proposed fix
-```` +```
53-56: Consider documenting schema limitation.The Info block mentions that internal Supabase RPCs are excluded, but doesn't mention that RPC function generation is currently scoped to the 'public' schema only. Users with functions in other schemas may be confused when their functions aren't discovered.
Based on learnings, consider adding a note about this limitation to set proper expectations.
💡 Suggested addition
<Info> - Internal Supabase RPCs (like `get_schema_info`) are excluded by default for - security and clarity. + **Note:** RPC function generation is currently limited to the `public` schema. + Internal Supabase RPCs (like `get_schema_info`) are excluded by default for + security and clarity. If your functions are in other schemas, they won't be + discovered automatically. </Info>
📜 Review details
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (9)
docs.jsondocs/environments/core.mdxdocs/environments/flutter.mdxdocs/environments/serverpod.mdxdocs/functions/rpc.mdxdocs/getting-started/index.mdxdocs/index.mdxdocs/models/enums.mdxdocs/models/tables.mdx
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: jwelmac
Repo: Khuwn-Soulutions/supabase_codegen PR: 82
File: packages/supabase_codegen/bin/sql/get_rpc_functions.dart:18-18
Timestamp: 2025-12-05T21:36:42.890Z
Learning: For supabase_codegen RPC function generation: the initial implementation (PR #82) is intentionally scoped to discover RPC functions only in the 'public' schema. Multi-schema support is planned for a subsequent PR.
📚 Learning: 2025-12-08T19:48:00.427Z
Learnt from: jwelmac
Repo: Khuwn-Soulutions/supabase_codegen PR: 82
File: packages/supabase_codegen/lib/src/generator/generator.dart:6-7
Timestamp: 2025-12-08T19:48:00.427Z
Learning: In packages/supabase_codegen/lib/src/generator/generator.dart, the exports for rpcs/_rpcs.dart and utils/utils.dart are intended for use by other internal projects within the organization, not for external public consumption. Advanced external users who leverage these should read the internal documentation of the methods directly.
Applied to files:
docs/getting-started/index.mdxdocs/functions/rpc.mdxdocs/environments/flutter.mdxdocs/models/enums.mdxdocs/environments/serverpod.mdxdocs/environments/core.mdxdocs/index.mdx
📚 Learning: 2025-12-08T17:28:59.275Z
Learnt from: jwelmac
Repo: Khuwn-Soulutions/supabase_codegen PR: 82
File: packages/supabase_codegen_serverpod/example/example_server/test/integration/greeting_endpoint_test.dart:6-12
Timestamp: 2025-12-08T17:28:59.275Z
Learning: In packages/supabase_codegen_serverpod/example/example_server/test/integration/greeting_endpoint_test.dart, the integration tests are intentionally skipped by default (SKIP_GREETING_INTEGRATION_TEST with defaultValue: true) because the test setup is more extensive than needed for the project at this time. The run pipeline may be updated in the future to enable these tests if deemed necessary.
Applied to files:
docs/getting-started/index.mdxdocs/environments/flutter.mdxdocs/environments/serverpod.mdxdocs/environments/core.mdx
📚 Learning: 2025-12-05T21:36:42.890Z
Learnt from: jwelmac
Repo: Khuwn-Soulutions/supabase_codegen PR: 82
File: packages/supabase_codegen/bin/sql/get_rpc_functions.dart:18-18
Timestamp: 2025-12-05T21:36:42.890Z
Learning: For supabase_codegen RPC function generation: the initial implementation (PR #82) is intentionally scoped to discover RPC functions only in the 'public' schema. Multi-schema support is planned for a subsequent PR.
Applied to files:
docs/functions/rpc.mdxdocs/environments/serverpod.mdx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (9)
docs/environments/core.mdx (2)
1-99: LGTM!The documentation is well-structured with clear sections for installation, setup, CLI usage, and client configuration. The use of tabs for different initialization methods provides good UX.
16-16: Update the package version to the latest available on pub.dev.The specified version
^4.0.0does not exist on pub.dev. The latest version ofsupabase_codegenis3.0.1. Update this constraint to^3.0.1(or an appropriate version that exists), and verify the same version is corrected across all documentation files that reference it.⛔ Skipped due to learnings
Learnt from: jwelmac Repo: Khuwn-Soulutions/supabase_codegen PR: 82 File: packages/supabase_codegen/lib/src/generator/generator.dart:6-7 Timestamp: 2025-12-08T19:48:00.427Z Learning: In packages/supabase_codegen/lib/src/generator/generator.dart, the exports for rpcs/_rpcs.dart and utils/utils.dart are intended for use by other internal projects within the organization, not for external public consumption. Advanced external users who leverage these should read the internal documentation of the methods directly.Learnt from: jwelmac Repo: Khuwn-Soulutions/supabase_codegen PR: 82 File: packages/supabase_codegen/bin/sql/get_rpc_functions.dart:18-18 Timestamp: 2025-12-05T21:36:42.890Z Learning: For supabase_codegen RPC function generation: the initial implementation (PR #82) is intentionally scoped to discover RPC functions only in the 'public' schema. Multi-schema support is planned for a subsequent PR.docs/models/enums.mdx (1)
1-47: LGTM!The enum documentation clearly explains the mapping between PostgreSQL and Dart enums, with good examples and proper warnings about regenerating types.
Also applies to: 52-56
docs/getting-started/index.mdx (1)
1-37: LGTM!The getting started guide provides a clear overview of the three package variants and a straightforward quick start workflow. The CardGroup presentation is effective.
Also applies to: 49-53, 65-69
docs/index.mdx (1)
1-47: LGTM!The main documentation index provides an excellent overview with clear navigation to key sections. The use of CardGroup and Tabs effectively showcases the package's capabilities and use cases.
docs.json (1)
1-109: LGTM!The documentation site configuration is well-structured with clear navigation sections and appropriate metadata. The sidebar organization logically groups content by General, Getting Started, Environments, Models, Functions, and Packages.
docs/environments/serverpod.mdx (1)
1-84: LGTM!The Serverpod documentation is comprehensive and well-structured. It clearly explains the setup process, type mappings, and important exclusions. The use of Steps and Info components enhances readability.
docs/environments/flutter.mdx (1)
1-39: LGTM!The Flutter documentation provides clear guidance on installation, setup, and integration. The automatic environment loading feature and service getters are well-documented with practical examples.
Also applies to: 41-86
docs/models/tables.mdx (1)
1-86: LGTM!The tables documentation effectively explains the generated classes with clear examples. The use of an Accordion for the generated code example is a good UX decision, and the CRUD operation examples are practical and easy to follow.
| { | ||
| "name": "Supabase Codegen", | ||
| "description": "Generate type-safe Dart models from your Supabase database.", | ||
| "favicon": "https://raw.githubusercontent.com/Khuwn-Soulutions/supabase_codegen/main/assets/logo.png", |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify GitHub URLs are accessible
echo "=== Checking favicon URL ==="
curl -I -s "https://raw.githubusercontent.com/Khuwn-Soulutions/supabase_codegen/main/assets/logo.png" | head -n 1
echo -e "\n=== Checking package tree URLs ==="
for path in \
"packages/supabase_codegen" \
"packages/supabase_codegen_flutter" \
"packages/supabase_codegen_serverpod"; do
echo "Checking: $path"
curl -I -s "https://github.com/Khuwn-Soulutions/supabase_codegen/tree/main/$path" | head -n 1
done
echo -e "\n=== Verifying package directories exist locally ==="
for dir in packages/supabase_codegen packages/supabase_codegen_flutter packages/supabase_codegen_serverpod; do
if [ -d "$dir" ]; then
echo "✓ $dir exists"
else
echo "✗ $dir not found"
fi
doneRepository: Khuwn-Soulutions/supabase_codegen
Length of output: 495
🏁 Script executed:
cat -n docs.jsonRepository: Khuwn-Soulutions/supabase_codegen
Length of output: 3295
Fix broken favicon URL.
The favicon URL on line 4 returns a 404 error and is not accessible. The referenced asset path does not exist or is unavailable. The package links on lines 96-105 are accessible and valid.
🤖 Prompt for AI Agents
In docs.json around line 4, the configured favicon URL
("https://raw.githubusercontent.com/Khuwn-Soulutions/supabase_codegen/main/assets/logo.png")
is broken (404); replace it with a valid, accessible favicon URL (e.g., point to
an existing asset in this repo or the working package assets referenced on lines
96-105), update the JSON value to that new URL, and verify the new link returns
HTTP 200 and serves an image.
There was a problem hiding this comment.
Actionable comments posted: 5
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/supabase_codegen_flutter/bin/init.dart (1)
8-12: UnawaitedFuture— consider makingmainasync.
initializeConfiguration()returnsFuture<void>, but the synchronous arrow function doesn't await it. This means the process may exit before configuration completes, especially if the function performs async I/O operations.🔎 Proposed fix
/// Call the supabase_codegen init with relevant environment -void main() => initializeConfiguration( +Future<void> main() => initializeConfiguration( forFlutter: true, defaultEnvPath: defaultEnvFile, defaultOutputPath: defaultOutputPath, );Or, if you also need to call
checkMigration()for consistency with the core package:/// Call the supabase_codegen init with relevant environment -void main() => initializeConfiguration( - forFlutter: true, - defaultEnvPath: defaultEnvFile, - defaultOutputPath: defaultOutputPath, -); +Future<void> main() async { + await initializeConfiguration( + forFlutter: true, + defaultEnvPath: defaultEnvFile, + defaultOutputPath: defaultOutputPath, + ); + // await checkMigration(); // if needed for consistency +}
📜 Review details
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (15)
docs/functions/rpc.mdxpackages/supabase_codegen/bin/add_codegen_functions.dartpackages/supabase_codegen/bin/generate_types.dartpackages/supabase_codegen/bin/init.dartpackages/supabase_codegen/lib/init/init.dartpackages/supabase_codegen/lib/migrations/check_migration.dartpackages/supabase_codegen/lib/migrations/migrations.dartpackages/supabase_codegen/lib/migrations/sql/codegen_sql_function.dartpackages/supabase_codegen/lib/migrations/sql/get_enum_types.dartpackages/supabase_codegen/lib/migrations/sql/get_rpc_functions.dartpackages/supabase_codegen/lib/migrations/sql/get_schema_info.dartpackages/supabase_codegen/lib/migrations/sql/sql.dartpackages/supabase_codegen_flutter/bin/init.dartpackages/supabase_codegen_flutter/pubspec.yamlpackages/supabase_codegen_serverpod/bin/init.dart
🧰 Additional context used
🧠 Learnings (6)
📓 Common learnings
Learnt from: jwelmac
Repo: Khuwn-Soulutions/supabase_codegen PR: 82
File: packages/supabase_codegen/bin/sql/get_rpc_functions.dart:18-18
Timestamp: 2025-12-05T21:36:42.890Z
Learning: For supabase_codegen RPC function generation: the initial implementation (PR #82) is intentionally scoped to discover RPC functions only in the 'public' schema. Multi-schema support is planned for a subsequent PR.
📚 Learning: 2025-12-08T19:48:00.427Z
Learnt from: jwelmac
Repo: Khuwn-Soulutions/supabase_codegen PR: 82
File: packages/supabase_codegen/lib/src/generator/generator.dart:6-7
Timestamp: 2025-12-08T19:48:00.427Z
Learning: In packages/supabase_codegen/lib/src/generator/generator.dart, the exports for rpcs/_rpcs.dart and utils/utils.dart are intended for use by other internal projects within the organization, not for external public consumption. Advanced external users who leverage these should read the internal documentation of the methods directly.
Applied to files:
packages/supabase_codegen_flutter/pubspec.yamlpackages/supabase_codegen/lib/migrations/migrations.dartpackages/supabase_codegen_flutter/bin/init.dartpackages/supabase_codegen/lib/migrations/check_migration.dartpackages/supabase_codegen_serverpod/bin/init.dartdocs/functions/rpc.mdxpackages/supabase_codegen/bin/init.dartpackages/supabase_codegen/lib/init/init.dartpackages/supabase_codegen/bin/generate_types.dartpackages/supabase_codegen/bin/add_codegen_functions.dart
📚 Learning: 2025-12-22T14:30:19.980Z
Learnt from: jwelmac
Repo: Khuwn-Soulutions/supabase_codegen PR: 89
File: packages/supabase_codegen_templates/tables_and_enums/__brick__/tables/{{#tables}}{{{name}}}.dart{{/tables}}:30-31
Timestamp: 2025-12-22T14:30:19.980Z
Learning: In Dart 3.8+, use null-aware element syntax to include map entries only when the value is non-null, e.g. {key: ?value} omits the entry if value is null. Prefer this over conditional map entries like if (value != null) key: value. Apply this pattern to all Dart files where map literals are constructed to improve readability and avoid extra conditionals.
Applied to files:
packages/supabase_codegen/lib/migrations/migrations.dartpackages/supabase_codegen_flutter/bin/init.dartpackages/supabase_codegen/lib/migrations/check_migration.dartpackages/supabase_codegen_serverpod/bin/init.dartpackages/supabase_codegen/bin/init.dartpackages/supabase_codegen/lib/init/init.dartpackages/supabase_codegen/bin/generate_types.dartpackages/supabase_codegen/bin/add_codegen_functions.dart
📚 Learning: 2025-12-05T21:36:42.890Z
Learnt from: jwelmac
Repo: Khuwn-Soulutions/supabase_codegen PR: 82
File: packages/supabase_codegen/bin/sql/get_rpc_functions.dart:18-18
Timestamp: 2025-12-05T21:36:42.890Z
Learning: For supabase_codegen RPC function generation: the initial implementation (PR #82) is intentionally scoped to discover RPC functions only in the 'public' schema. Multi-schema support is planned for a subsequent PR.
Applied to files:
packages/supabase_codegen/lib/migrations/check_migration.dartdocs/functions/rpc.mdxpackages/supabase_codegen/bin/generate_types.dartpackages/supabase_codegen/bin/add_codegen_functions.dart
📚 Learning: 2025-12-08T17:28:59.275Z
Learnt from: jwelmac
Repo: Khuwn-Soulutions/supabase_codegen PR: 82
File: packages/supabase_codegen_serverpod/example/example_server/test/integration/greeting_endpoint_test.dart:6-12
Timestamp: 2025-12-08T17:28:59.275Z
Learning: In packages/supabase_codegen_serverpod/example/example_server/test/integration/greeting_endpoint_test.dart, the integration tests are intentionally skipped by default (SKIP_GREETING_INTEGRATION_TEST with defaultValue: true) because the test setup is more extensive than needed for the project at this time. The run pipeline may be updated in the future to enable these tests if deemed necessary.
Applied to files:
packages/supabase_codegen_serverpod/bin/init.dartpackages/supabase_codegen/bin/init.dart
📚 Learning: 2025-12-08T19:55:36.377Z
Learnt from: jwelmac
Repo: Khuwn-Soulutions/supabase_codegen PR: 82
File: packages/supabase_codegen/lib/src/generator/generator_config/rpc/rpc_return_config.dart:13-20
Timestamp: 2025-12-08T19:55:36.377Z
Learning: In packages/supabase_codegen, the fromJson factory methods in configuration classes (e.g., RpcReturnTypeConfig, RpcConfig, GeneratorConfig) are intended only for internal round-trip serialization from toJson, not for deserializing external or user-provided JSON. Therefore, they do not require defensive error handling for invalid enum names or malformed structures.
Applied to files:
docs/functions/rpc.mdx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (9)
docs/functions/rpc.mdx (1)
53-55: Well done addressing the schema limitation documentation.This Info block clearly documents the public schema restriction, addressing the previous review feedback. Users now have proper expectations about RPC discovery scope.
Based on learnings, this limitation is intentional and accurately documented.
packages/supabase_codegen/bin/add_codegen_functions.dart (1)
1-5: LGTM!Clean delegation to the centralized migrations module. The async/await pattern is correctly applied.
packages/supabase_codegen/lib/migrations/migrations.dart (1)
1-2: LGTM!Clean barrel file that centralizes migration exports. This aligns with the broader refactor to consolidate migration-related APIs.
packages/supabase_codegen_flutter/pubspec.yaml (1)
34-37: LGTM!The new
initexecutable is correctly added, following the existing pattern. This enables users to rundart run supabase_codegen_flutter:initto initialize Flutter-specific configuration.packages/supabase_codegen/bin/generate_types.dart (1)
3-10: LGTM!The migration check is appropriately invoked before type generation, ensuring that any necessary database migrations are applied first. The import refactor to use the centralized migrations barrel is correct.
packages/supabase_codegen/bin/init.dart (1)
1-8: LGTM!The initialization sequence correctly awaits configuration setup before checking migrations. The async conversion and import additions are properly implemented.
packages/supabase_codegen_serverpod/bin/init.dart (1)
8-14: Verify ifcheckMigration()should be called here for consistency.The core package's
bin/init.dartcalls bothinitializeConfiguration()andcheckMigration(), but this Serverpod variant only callsinitializeConfiguration()followed byaddExtraClassesToGeneratorConfig().If the migration check is intentionally omitted for Serverpod (e.g., migrations are handled elsewhere), this is fine. Otherwise, consider adding the
checkMigration()call for consistency with the core package.packages/supabase_codegen/lib/init/init.dart (1)
9-12: LGTM!The rename from
init()toinitializeConfiguration()improves API clarity. The function signature and delegation pattern are correct—returningFuture<void>frommain()ensures the Dart runtime awaits completion.packages/supabase_codegen/lib/migrations/check_migration.dart (1)
19-31: LGTM!Clean orchestration function with proper null handling and Dart 3 record destructuring.
| /// Extract the path from the given [input] | ||
| String extractPath(String input) { | ||
| // Define a regular expression to match the path | ||
| final pathRegExp = RegExp(r'\b\w+/\w+/\d+_\w+\.sql\b'); | ||
|
|
||
| // Find the match in the input string | ||
| final Match? match = pathRegExp.firstMatch(input); | ||
|
|
||
| // If a match is found, return the matched path | ||
| if (match != null) { | ||
| return match.group(0)!; | ||
| } | ||
|
|
||
| // If no match is found, return an empty string or handle it as needed | ||
| return ''; | ||
| } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# First, locate and examine the extractPath function
find . -name "check_migration.dart" -type fRepository: Khuwn-Soulutions/supabase_codegen
Length of output: 140
🏁 Script executed:
# Search for any test files related to check_migration
fd -type f -name "*check_migration*" -o -name "*test*" | grep -i "check_migration\|test.*migration"Repository: Khuwn-Soulutions/supabase_codegen
Length of output: 247
🏁 Script executed:
# Search for usages of extractPath function
rg -n "extractPath" --type dartRepository: Khuwn-Soulutions/supabase_codegen
Length of output: 296
🏁 Script executed:
# Read the file to see the context of extractPath usage
cat -n ./packages/supabase_codegen/lib/migrations/check_migration.dart | head -130 | tail -40Repository: Khuwn-Soulutions/supabase_codegen
Length of output: 1434
🏁 Script executed:
# Search for test files in the project
find . -type f -name "*.dart" | grep -i testRepository: Khuwn-Soulutions/supabase_codegen
Length of output: 6463
🏁 Script executed:
# Search specifically for any tests of check_migration
rg -l "check_migration" --type dartRepository: Khuwn-Soulutions/supabase_codegen
Length of output: 133
🏁 Script executed:
# Search for migration-related tests or references
rg "extractPath|check_migration" --type dart -iRepository: Khuwn-Soulutions/supabase_codegen
Length of output: 377
🏁 Script executed:
# Check the migrations.dart file to see if there are any other references or tests
cat -n ./packages/supabase_codegen/lib/migrations/migrations.dart | head -50Repository: Khuwn-Soulutions/supabase_codegen
Length of output: 144
🏁 Script executed:
# Look for any test files that might test migration functionality
find ./packages/supabase_codegen/test -name "*migration*" -type fRepository: Khuwn-Soulutions/supabase_codegen
Length of output: 59
🏁 Script executed:
# Check if there are any comments or documentation about Supabase migration output format
rg "supabase migration" -i --type dart -C 3Repository: Khuwn-Soulutions/supabase_codegen
Length of output: 59
🏁 Script executed:
# Look at the entire check_migration.dart file to understand the context better
cat -n ./packages/supabase_codegen/lib/migrations/check_migration.dartRepository: Khuwn-Soulutions/supabase_codegen
Length of output: 4934
🏁 Script executed:
# Search for any Supabase CLI output examples in docs or tests
rg "20\d{2}\d{2}\d{2}" --type dartRepository: Khuwn-Soulutions/supabase_codegen
Length of output: 344
🏁 Script executed:
# Search for any Supabase CLI related documentation or comments in the codebase
rg -i "supabase.*migration.*new\|supabase.*output" --type dart -C 2Repository: Khuwn-Soulutions/supabase_codegen
Length of output: 59
🏁 Script executed:
# Check if there are any issues or comments about Supabase CLI output format
rg -i "cli.*output\|stdout" ./packages/supabase_codegen/lib/migrations/check_migration.dart -C 2Repository: Khuwn-Soulutions/supabase_codegen
Length of output: 59
🌐 Web query:
Supabase CLI migration new command output format path
💡 Result:
The command creates a file under a local supabase/migrations directory with the name format:
supabase/migrations/_<migration_name>.sql
(e.g. supabase/migrations/20230306095710_schema_test.sql). [1][2]
Sources:
[1] Supabase CLI docs — supabase migration new.
[2] Supabase docs — creating/pulling migrations (supabase/migrations/_*.sql).
Add tests for extractPath() to prevent regressions if the Supabase CLI output format changes.
The regex pattern works correctly for the documented Supabase migration output format (supabase/migrations/<timestamp>_<name>.sql). However, there are no tests for this function. Since it depends on external tool output, adding test cases would catch potential breakage if the Supabase CLI output format changes in the future. The error handling is defensive—returning an empty string and relying on the caller to log detailed CLI output for debugging—which is good, but tests would provide additional safety.
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (5)
docs/functions/rpc.mdxpackages/supabase_codegen/lib/migrations/sql/get_enum_types.dartpackages/supabase_codegen/lib/migrations/sql/get_rpc_functions.dartpackages/supabase_codegen/lib/migrations/sql/get_schema_info.dartpackages/supabase_codegen/lib/migrations/sql/sql.dart
🧰 Additional context used
🧠 Learnings (4)
📚 Learning: 2025-12-08T19:48:00.427Z
Learnt from: jwelmac
Repo: Khuwn-Soulutions/supabase_codegen PR: 82
File: packages/supabase_codegen/lib/src/generator/generator.dart:6-7
Timestamp: 2025-12-08T19:48:00.427Z
Learning: In packages/supabase_codegen/lib/src/generator/generator.dart, the exports for rpcs/_rpcs.dart and utils/utils.dart are intended for use by other internal projects within the organization, not for external public consumption. Advanced external users who leverage these should read the internal documentation of the methods directly.
Applied to files:
docs/functions/rpc.mdxpackages/supabase_codegen/lib/migrations/sql/get_schema_info.dartpackages/supabase_codegen/lib/migrations/sql/get_enum_types.dartpackages/supabase_codegen/lib/migrations/sql/get_rpc_functions.dartpackages/supabase_codegen/lib/migrations/sql/sql.dart
📚 Learning: 2025-12-05T21:36:42.890Z
Learnt from: jwelmac
Repo: Khuwn-Soulutions/supabase_codegen PR: 82
File: packages/supabase_codegen/bin/sql/get_rpc_functions.dart:18-18
Timestamp: 2025-12-05T21:36:42.890Z
Learning: For supabase_codegen RPC function generation: the initial implementation (PR #82) is intentionally scoped to discover RPC functions only in the 'public' schema. Multi-schema support is planned for a subsequent PR.
Applied to files:
docs/functions/rpc.mdxpackages/supabase_codegen/lib/migrations/sql/get_schema_info.dartpackages/supabase_codegen/lib/migrations/sql/get_enum_types.dartpackages/supabase_codegen/lib/migrations/sql/get_rpc_functions.dartpackages/supabase_codegen/lib/migrations/sql/sql.dart
📚 Learning: 2025-12-08T19:55:36.377Z
Learnt from: jwelmac
Repo: Khuwn-Soulutions/supabase_codegen PR: 82
File: packages/supabase_codegen/lib/src/generator/generator_config/rpc/rpc_return_config.dart:13-20
Timestamp: 2025-12-08T19:55:36.377Z
Learning: In packages/supabase_codegen, the fromJson factory methods in configuration classes (e.g., RpcReturnTypeConfig, RpcConfig, GeneratorConfig) are intended only for internal round-trip serialization from toJson, not for deserializing external or user-provided JSON. Therefore, they do not require defensive error handling for invalid enum names or malformed structures.
Applied to files:
docs/functions/rpc.mdx
📚 Learning: 2025-12-22T14:30:19.980Z
Learnt from: jwelmac
Repo: Khuwn-Soulutions/supabase_codegen PR: 89
File: packages/supabase_codegen_templates/tables_and_enums/__brick__/tables/{{#tables}}{{{name}}}.dart{{/tables}}:30-31
Timestamp: 2025-12-22T14:30:19.980Z
Learning: In Dart 3.8+, use null-aware element syntax to include map entries only when the value is non-null, e.g. {key: ?value} omits the entry if value is null. Prefer this over conditional map entries like if (value != null) key: value. Apply this pattern to all Dart files where map literals are constructed to improve readability and avoid extra conditionals.
Applied to files:
packages/supabase_codegen/lib/migrations/sql/get_schema_info.dartpackages/supabase_codegen/lib/migrations/sql/get_enum_types.dartpackages/supabase_codegen/lib/migrations/sql/get_rpc_functions.dartpackages/supabase_codegen/lib/migrations/sql/sql.dart
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (5)
packages/supabase_codegen/lib/migrations/sql/get_schema_info.dart (1)
1-1: LGTM: Package import improves maintainability.The change from a relative import to a package import follows Dart best practices and improves refactoring safety and IDE support.
packages/supabase_codegen/lib/migrations/sql/get_enum_types.dart (1)
1-1: LGTM: Consistent with package import refactor.The import path change aligns with the refactoring applied across all SQL migration files, ensuring consistency.
packages/supabase_codegen/lib/migrations/sql/get_rpc_functions.dart (1)
1-1: LGTM: Package import refactor complete.This completes the consistent migration to package imports across all SQL migration files in the module.
packages/supabase_codegen/lib/migrations/sql/sql.dart (1)
1-10: Well-structured barrel file for SQL migrations.The new aggregator module follows Dart conventions and provides a clean public API surface. The
sqlFunctionslist offers convenient access to all migration DDL statements.docs/functions/rpc.mdx (1)
195-203: Well documented limitations.The Notes section clearly communicates important constraints about schema scope and internal RPC exclusions, which properly sets user expectations. This addresses previous feedback about documenting the public schema limitation.
Based on learnings, the 'public' schema limitation is intentional for the initial implementation, with multi-schema support planned for a subsequent release.
There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (1)
packages/supabase_codegen/lib/migrations/check_migration.dart (1)
88-103: Check CLI exit code before processing output.The previous review comment about checking
result.exitCodebefore extracting the path has not been addressed. The CLI command may fail for various reasons (CLI not installed, permission issues, etc.), but only path extraction failure is handled.🔎 Proposed fix
/// Create new migration using supabase CLI final result = await Process.run('supabase', [ 'migration', 'new', name, ], runInShell: true); + /// Check if CLI command succeeded + if (result.exitCode != 0) { + logger + ..err('Supabase CLI failed to create migration.') + ..detail('Exit code: ${result.exitCode}') + ..detail('CLI stdout: ${result.stdout}') + ..detail('CLI stderr: ${result.stderr}'); + return false; + } + /// Read path of migration final path = extractPath(result.stdout.toString());
📜 Review details
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
packages/supabase_codegen/lib/migrations/check_migration.dart
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-12-08T19:48:00.427Z
Learnt from: jwelmac
Repo: Khuwn-Soulutions/supabase_codegen PR: 82
File: packages/supabase_codegen/lib/src/generator/generator.dart:6-7
Timestamp: 2025-12-08T19:48:00.427Z
Learning: In packages/supabase_codegen/lib/src/generator/generator.dart, the exports for rpcs/_rpcs.dart and utils/utils.dart are intended for use by other internal projects within the organization, not for external public consumption. Advanced external users who leverage these should read the internal documentation of the methods directly.
Applied to files:
packages/supabase_codegen/lib/migrations/check_migration.dart
📚 Learning: 2025-12-05T21:36:42.890Z
Learnt from: jwelmac
Repo: Khuwn-Soulutions/supabase_codegen PR: 82
File: packages/supabase_codegen/bin/sql/get_rpc_functions.dart:18-18
Timestamp: 2025-12-05T21:36:42.890Z
Learning: For supabase_codegen RPC function generation: the initial implementation (PR #82) is intentionally scoped to discover RPC functions only in the 'public' schema. Multi-schema support is planned for a subsequent PR.
Applied to files:
packages/supabase_codegen/lib/migrations/check_migration.dart
📚 Learning: 2025-12-22T14:30:19.980Z
Learnt from: jwelmac
Repo: Khuwn-Soulutions/supabase_codegen PR: 89
File: packages/supabase_codegen_templates/tables_and_enums/__brick__/tables/{{#tables}}{{{name}}}.dart{{/tables}}:30-31
Timestamp: 2025-12-22T14:30:19.980Z
Learning: In Dart 3.8+, use null-aware element syntax to include map entries only when the value is non-null, e.g. {key: ?value} omits the entry if value is null. Prefer this over conditional map entries like if (value != null) key: value. Apply this pattern to all Dart files where map literals are constructed to improve readability and avoid extra conditionals.
Applied to files:
packages/supabase_codegen/lib/migrations/check_migration.dart
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (2)
packages/supabase_codegen/lib/migrations/check_migration.dart (2)
53-72: Async file I/O now correctly used.The synchronous
readAsStringSync()has been replaced withawait File(file).readAsString(), preventing event loop blocking. The logic for detecting function changes across migration files is sound.
114-129: Path extraction implementation is appropriate.The regex correctly matches the documented Supabase migration output format. The defensive approach of returning an empty string allows the caller to provide detailed diagnostic information when extraction fails.
| /// Check for migration to apply to add or update codegen functions | ||
| Future<void> checkMigration() async { | ||
| final result = await getMigration(); | ||
| if (result == null) { | ||
| logger.info('No migration to apply.'); | ||
| return; | ||
| } | ||
|
|
||
| final (:migration, :name) = result; | ||
| logger.detail(dcli.green('Migration to add/update: $name')); | ||
| await addCodegenFunctionsMigration(migration: migration, name: name); | ||
| logger.success('Migration created please apply to your database.'); | ||
| } |
There was a problem hiding this comment.
Success message logged regardless of actual outcome.
addCodegenFunctionsMigration can fail silently (early return on CLI failure or path extraction failure) without indicating failure. The success message on line 30 will still be logged, giving the user incorrect feedback.
Consider having addCodegenFunctionsMigration return a boolean or throw on failure, so checkMigration can conditionally log the success message.
🔎 Proposed fix
/// Add codegen functions migration
-Future<void> addCodegenFunctionsMigration({
+Future<bool> addCodegenFunctionsMigration({
required String migration,
String name = _addFunctions,
}) async {
/// Create new migration using supabase CLI
final result = await Process.run('supabase', [
'migration',
'new',
name,
], runInShell: true);
/// Read path of migration
final path = extractPath(result.stdout.toString());
if (path.isEmpty) {
logger
..err('Failed to extract migration path from CLI output.')
..detail('CLI stdout: ${result.stdout}')
..detail('CLI stderr: ${result.stderr}');
- return;
+ return false;
}
/// Write the sql functions to migration file
path.write(migration);
// Print result to shell
// ignore: avoid_print
final pathLink = link(uri: Uri.file(path), message: path);
logger.info('Migration file created at: $pathLink');
+ return true;
}Then update checkMigration:
final (:migration, :name) = result;
logger.detail(dcli.green('Migration to add/update: $name'));
- await addCodegenFunctionsMigration(migration: migration, name: name);
- logger.success('Migration created please apply to your database.');
+ final success = await addCodegenFunctionsMigration(migration: migration, name: name);
+ if (success) {
+ logger.success('Migration created please apply to your database.');
+ }
}🤖 Prompt for AI Agents
In packages/supabase_codegen/lib/migrations/check_migration.dart around lines 19
to 31, the code always logs a success message even when
addCodegenFunctionsMigration may fail silently; change
addCodegenFunctionsMigration to either return a boolean indicating
success/failure or throw on error, then update checkMigration to await the call,
check the boolean (or wrap in try/catch) and only call logger.success when the
operation actually succeeded; on failure log an error message or rethrow the
exception so callers get correct feedback.
| /// Write the sql functions to migration file | ||
| path.write(migration); |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Prefer async file write for consistency.
path.write(migration) uses dcli's synchronous String.write() extension. For consistency with the async approach used elsewhere in this file (e.g., readAsString), consider using await File(path).writeAsString(migration).
🔎 Proposed fix
/// Write the sql functions to migration file
- path.write(migration);
+ await File(path).writeAsString(migration);📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| /// Write the sql functions to migration file | |
| path.write(migration); | |
| /// Write the sql functions to migration file | |
| await File(path).writeAsString(migration); |
🤖 Prompt for AI Agents
In packages/supabase_codegen/lib/migrations/check_migration.dart around lines
105–106, the code uses the synchronous String.write() extension
(path.write(migration)) to write the migration; change this to an async file
write by using await File(path).writeAsString(migration), ensure the enclosing
function is marked async, import dart:io if missing, and propagate or handle the
returned Future (e.g., await the call) for consistency with other async I/O in
this file.
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (3)
packages/supabase_codegen/lib/migrations/check_migration.dart (3)
19-31: Success message logged regardless of actual outcome.
addCodegenFunctionsMigrationcan fail silently (early return on lines 102 or 112) without indicating failure, yet the success message on line 30 will still be logged, giving incorrect feedback to the user.This issue was previously flagged and remains unaddressed. Consider having
addCodegenFunctionsMigrationreturn a boolean or throw on failure, socheckMigrationcan conditionally log the success message only when the operation actually succeeds.
116-116: Prefer async file write for consistency.
path.write(migration)uses dcli's synchronous write operation, which blocks the event loop. Since this is already an async function and other file I/O in this file uses async methods (e.g.,readAsStringon line 55), using async file write here would be more consistent.This issue was previously flagged and remains unaddressed.
🔎 Proposed fix
/// Write the sql functions to migration file - path.write(migration); + await File(path).writeAsString(migration);
124-139: Consider adding tests forextractPath()to prevent regressions.The regex pattern correctly handles the documented Supabase CLI migration output format (
supabase/migrations/<timestamp>_<name>.sql). However, since this function depends on external tool output, adding test cases would provide safety if the CLI output format changes in future versions.This suggestion was previously made and remains valid.
📜 Review details
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
packages/supabase_codegen/lib/migrations/check_migration.dart
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: jwelmac
Repo: Khuwn-Soulutions/supabase_codegen PR: 82
File: packages/supabase_codegen/bin/sql/get_rpc_functions.dart:18-18
Timestamp: 2025-12-05T21:36:42.890Z
Learning: For supabase_codegen RPC function generation: the initial implementation (PR #82) is intentionally scoped to discover RPC functions only in the 'public' schema. Multi-schema support is planned for a subsequent PR.
📚 Learning: 2025-12-08T19:48:00.427Z
Learnt from: jwelmac
Repo: Khuwn-Soulutions/supabase_codegen PR: 82
File: packages/supabase_codegen/lib/src/generator/generator.dart:6-7
Timestamp: 2025-12-08T19:48:00.427Z
Learning: In packages/supabase_codegen/lib/src/generator/generator.dart, the exports for rpcs/_rpcs.dart and utils/utils.dart are intended for use by other internal projects within the organization, not for external public consumption. Advanced external users who leverage these should read the internal documentation of the methods directly.
Applied to files:
packages/supabase_codegen/lib/migrations/check_migration.dart
📚 Learning: 2025-12-22T14:30:19.980Z
Learnt from: jwelmac
Repo: Khuwn-Soulutions/supabase_codegen PR: 89
File: packages/supabase_codegen_templates/tables_and_enums/__brick__/tables/{{#tables}}{{{name}}}.dart{{/tables}}:30-31
Timestamp: 2025-12-22T14:30:19.980Z
Learning: In Dart 3.8+, use null-aware element syntax to include map entries only when the value is non-null, e.g. {key: ?value} omits the entry if value is null. Prefer this over conditional map entries like if (value != null) key: value. Apply this pattern to all Dart files where map literals are constructed to improve readability and avoid extra conditionals.
Applied to files:
packages/supabase_codegen/lib/migrations/check_migration.dart
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (3)
packages/supabase_codegen/lib/migrations/check_migration.dart (3)
9-17: LGTM!The constants are well-named, appropriately scoped, and used consistently throughout the file.
33-81: LGTM!The migration detection logic is well-structured and defensive. The use of async file I/O, sorted file processing, and list copies to avoid concurrent modification demonstrates good practices. The string-based function matching is pragmatic for this use case.
95-103: LGTM!The exit code validation ensures that CLI failures are properly detected and reported before attempting to extract the migration path. This addresses the previously flagged issue and provides clear error diagnostics.
| import 'package:dcli/dcli.dart' as dcli; | ||
| import 'package:mason_logger/mason_logger.dart'; | ||
| import 'package:path/path.dart'; | ||
| import 'package:supabase_codegen/migrations/migrations.dart'; |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Import sql.dart directly instead of the barrel file.
This file imports migrations.dart, which in turn exports this file (check_migration.dart) and sql.dart. Since the only symbol used from that import is sqlFunctions (defined in sql.dart), directly importing sql.dart would reduce coupling and avoid potential circular dependency issues.
🔎 Proposed fix
-import 'package:supabase_codegen/migrations/migrations.dart';
+import 'package:supabase_codegen/migrations/sql/sql.dart';📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| import 'package:supabase_codegen/migrations/migrations.dart'; | |
| import 'package:supabase_codegen/migrations/sql/sql.dart'; |
🤖 Prompt for AI Agents
In packages/supabase_codegen/lib/migrations/check_migration.dart around line 6,
the file currently imports the barrel file migrations.dart but only uses
sqlFunctions from sql.dart; replace the barrel import with a direct import of
sql.dart (e.g. import 'package:supabase_codegen/migrations/sql.dart';), remove
the existing migrations.dart import, and ensure any references to sqlFunctions
still resolve—this reduces coupling and avoids potential circular dependencies.
Status
IN DEVELOPMENT
Description
Create docs site
Closes #88
Type of Change
Summary by CodeRabbit
Documentation
Chores
✏️ Tip: You can customize this high-level summary in your review settings.