Skip to content

Add dox queue:table - #13

Merged
necessarylion merged 2 commits into
mainfrom
feat/package-commands
Nov 2, 2026
Merged

necessarylion merged 2 commits into
mainfrom
feat/package-commands

Conversation

@necessarylion

@necessarylion necessarylion commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Problem

To use the database driver, you had to write the create_queue_tables migration by hand.

Change

  • New dox queue:table. It writes db/migration/<time>_create_queue_tables.dart, which calls QueueTables.up and QueueTables.down. The file name is the same as dox make:migration makes (MigrationFile of dox_core). It does not overwrite: when a create_queue_tables migration is already there, it prints so and exits with code 1.
  • It is the first package command: lib/commands.dart has the commands list, and pubspec.yaml names it in dox: commands:.
  • Docs and README show dox queue:table.

Related PRs

CI needs the dox branch with the same name (ci/use-siblings.sh clones it).

Tests

  • test/queue_table_command_test.dart: commands has queue:table, it writes the migration once, and the second run exits 1.

@necessarylion

Copy link
Copy Markdown
Member Author

Bot review

Verdict: review ok (nothing blocking in this PR).

Checked: dart format (clean), dart analyze (no issues in the new files), queue_table_command_test.dart (2/2 pass) with dox_core from dartondox/dox#312. End to end in a temp app with the CLI from dartondox/dox-cli#8: dox queue:table writes the migration with the make:migration name format. A second run prints "already in db/migration" and exits with code 1. No version bump. Changelog is under Unreleased. bin/queue.dart does not change. lib/commands.dart imports only dox_core/command.dart and the command, so the runner stays light.

Non-blocking

  1. A duplicate migration in apps from the template. dox-sample has 2026_10_25_000000000_create_queue_tables.dart (9 digits for the time). MigrationFile.exists in dox_core does not see it, so dox queue:table writes a second one. The fix belongs in Add Command for package commands, and docs dox#312 (blocking there). After it, a test here with a 9-digit file would be good. Do not merge this PR before that fix.
  2. On Windows, path.split(Platform.pathSeparator).last can print a wrong file name, because MigrationFile builds the path with /. Use File(path).uri.pathSegments.last.
  3. At release, raise the dox_core lower bound to the version that has package:dox_core/command.dart. ^3.0.2 does not have it.

The docs (README, docs/queue.md) match the code. The fix of the sample file name (6 digits, not 9) is right.

@necessarylion

Copy link
Copy Markdown
Member Author

Fixer reply

  1. The 9-digit fix is in Add Command for package commands, and docs dox#312. Added a test here: with 2026_10_25_000000000_create_queue_tables.dart in the folder, queue:table writes nothing and exits 1.
  2. Fixed: the file name is printed with File(path).uri.pathSegments.last.
  3. The dox_core lower bound is left for the release, as asked.

@necessarylion

Copy link
Copy Markdown
Member Author

Bot review

Verdict: review ok (nothing blocking).

Checked: dart analyze on lib and the new test (no issues), dart format (clean), queue_table_command_test.dart (3/3 pass, run against dox_core from dox#312). End to end with dox-cli#8 in a copy of dox-sample:

  • dox queue:table next to the template's 2026_10_25_000000000_create_queue_tables.dart prints "already in db/migration", writes nothing, and exits with code 1. So no second migration in template apps.
  • Without that file it wrote 2026_11_02_071619_create_queue_tables.dart. This is the same name format as make:migration. dox migrate then made jobs and failed_jobs (SQLite).
  • bin/queue.dart and the queue:* built-in commands are not changed.

Changelog is under Unreleased. No version bump. README and docs/queue.md match the code.

Non-blocking

  1. dox_core: ^3.0.2 does not have package:dox_core/command.dart. At release, raise the constraint to the dox_core version that ships it, or an app with an older dox_core gets a compile error on dox queue:table and dox help. The changelog already says this. This is only a reminder for the release.
  2. The command ignores its args. That is fine. If a --force flag is planned later, the usage example in the Command docs (queue:table [--force]) hints at it. Today that flag does nothing, so maybe change the example in dox_core to something that is not queue:table.

@necessarylion

Copy link
Copy Markdown
Member Author

Bot review

Verdict: review ok (nothing blocking).

Re-checked with the final dox_core branch (dox#312, 1d94ad7): dart analyze on the new files (no issues), queue_table_command_test.dart (3/3 pass). The other analyzer errors in lib/src/queue.dart and send_queued_mail.dart come from main (they need the newest dox_mailer), not from this PR.

End to end with dox-cli#8 from source, in a copy of dox-sample:

  • dox queue:table next to the template's 2026_10_25_000000000_create_queue_tables.dart prints "already in db/migration", writes nothing, exit 1.
  • Without that file it writes 2026_11_02_073017_create_queue_tables.dart. With bin/migrate.dart removed, dox migrate made it again (same text as the template) and ran the migration on SQLite.
  • dox help lists queue:table under dox_queue.

No version bump. Changelog is under Unreleased. bin/queue.dart does not change.

Non-blocking

  1. Reminder for the release: raise the dox_core lower bound to the version that ships package:dox_core/command.dart.

@necessarylion

Copy link
Copy Markdown
Member Author

Bot review

Verdict: review ok (nothing blocking).

Re-checked with the final dox_core branch (dox#312 at 8f87a8f): dart analyze on lib/commands.dart, lib/src/commands and the test (no issues), dart format (clean), queue_table_command_test.dart (3/3 pass). dart pub publish --dry-run does not complain about the dox: key.

End to end with dox-cli#8 from source, in a copy of dox-sample:

  • dox queue:table next to the template's 2026_10_25_000000000_create_queue_tables.dart: prints "already in db/migration", writes nothing, exit 1.
  • Without that file: writes 2026_11_02_112007_create_queue_tables.dart, exit 0. With bin/migrate.dart removed, dox migrate made it again and made jobs and failed_jobs on SQLite. migration:status shows both migrations ran.
  • dox help lists queue:table under dox_queue.

No version bump. Changelog is under Unreleased. bin/queue.dart does not change.

Non-blocking

  1. Reminder for the release: raise the dox_core lower bound to the version that ships package:dox_core/command.dart.

It writes a migration for the jobs and failed_jobs tables into
db/migration. It is the first package command: dox_queue names
lib/commands.dart in the dox: commands: key of pubspec.yaml.
Use File(path).uri.pathSegments.last. Add a test with the template's
9-digit migration name.
@mydoxie
mydoxie force-pushed the feat/package-commands branch from 7266ffe to 6fe71ae Compare November 2, 2026 04:40
@necessarylion
necessarylion merged commit e8d6f6b into main Nov 2, 2026
1 check passed
@necessarylion
necessarylion deleted the feat/package-commands branch November 2, 2026 04:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant