Skip to content

Initial migration of task backend to typed_sql #8784

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

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

jonasfj
Copy link
Member

@jonasfj jonasfj commented May 22, 2025

No description provided.

@jonasfj jonasfj requested a review from isoos May 22, 2025 13:17
Copy link
Collaborator

@isoos isoos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think some files like database/model.dart is missing. Also needs merge fixes.
Otherwise I like really the new sql-way :)

@jonasfj jonasfj force-pushed the db-task-migration branch from 686703f to 06bd9c3 Compare May 23, 2025 08:19
Copy link
Collaborator

@isoos isoos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still looking good.

List<String> _updatedDependencies(
List<String>? dependencies,
List<String>? discoveredDependencies, {
List<String> _newDependencies(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's document what this method does.

Aside: This may be in another step, but with SQL, we should probably check if we can get away with simpler behavior, e.g. not reading and processing everything, or, maybe updating the dependent package's timestamp through a query.

name: 'task',
as: 'dependencies',
)
abstract final class TaskDependency extends Row {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this need @PrimaryKey[]?

Also, I'm wondering if the order of the keys should start with the dependency, maybe it could have performance benefits if/when later we update the dependent package's flag/timestamp with a query.


@immutable
@JsonSerializable()
final class TaskState implements CustomDataType<String> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: How far would it be to implement CustomDataType<Json> and using JSONB under the hood? I think it is so wasteful to keep this data as string instead of JSONB...

await db.tasks
.where((task) => task.runtimeVersion < gcBeforeRuntimeVersion.asExpr)
.delete()
.execute();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: wouldn't the delete() call before the where() make more sense? It kind of make sense for the select() projection to be just before e.g. stream() lie a few lines below, but for delete(), I could imagine it above it. This feels like the delete() and execute() calls should be a single method call, but maybe that fades more with further familiarity of the library use.

@@ -37,6 +37,11 @@ class _EnvConfig {
/// Youtube API key to use (skips Datastore secret).
late final youtubeApiKey = Platform.environment['YOUTUBE_API_KEY'];

/// True, if the process is running in a CI environment.
late final isContinuesIntegration = !['false', '0', ''].contains(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: rename to isContinuousIntegration or isCI?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

though, I think we should rather have the explicit true (or maybe 1) check instead of negating the negative.

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.

2 participants