Console: no in-process command dispatch, so a tenant cannot be migrated or seeded on its own connection
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
Research direction
Start with src/db/commands.rs around migrator and on_database, then review laravel-rust-database/src/db/seeders.rs and docs/console.md to understand the public command and database APIs. Decide which proposed API path fits the framework and how it should support tenant migrations and seeding. Done means application code can run the framework's migration or seeder work on a named connection without reimplementing its bookkeeping.
Written by the indexing model from the issue text.
Description
What I'm building
A database-per-tenant application. Each tenant's connection is registered at runtime:
db::manager().add_connection("ws4", with_database(template, "ws4"))?;
db::manager().using_connection("ws4", future).await
That part works well — the scoped switch is exactly what a tenant needs.
What works
The built-in commands already take a connection name: migrate --database=ws4, migrate:fresh --database=ws4, migrate:status --database=ws4 (laravel-rust/src/db/commands.rs:189, :283).
What's missing
An application command cannot reuse any of that for a tenant.
-
No in-process command dispatch. There is no
Artisan::call()equivalent — noConsole::call, and no mention of one indocs/console.md— so aworkspaces:migratecommand cannot invokemigrate --database=ws4. -
The per-connection runner is crate-private.
fn migrator(manager, database, migrations)(src/db/commands.rs:507) andpub(in crate::db) async fn on_database(..)(src/db/commands.rs:522) — the function that makes--databasethe default while migrations and seeders run — are unreachable from an application.Migratoritself is public (laravel-rust-database/src/db/migrations.rs:170), its construction and bookkeeping are not. -
Seeding is default-connection only.
laravel_rust_database::db::seeders::run(..)(laravel-rust-database/src/db/seeders.rs:181) takes no connection and runs "in one transaction on the default connection". There is no standalone seed command either — seeding is reached only throughmigrate --seed, which is inside the private path above.
Why it matters
Provisioning a tenant becomes a reimplementation: a hand-written migrator loop and its migrations bookkeeping, plus a hand-written seeder runner, instead of the framework's own. On a multi-tenant host that is the core operation — workspaces:migrate, workspaces:seed, workspaces:run <command> all need "run this on that connection", and none of them can be written against today's public API.
What would fix it
Any one of these is sufficient:
Console::call("migrate", ["--database", "ws4"])— Laravel'sArtisan::call, which makes the other two unnecessary;- or
pubonmigrator(..)andon_database(..), so an application can compose the existing runner; - or a
--databaseoption on a standalonedb:seedcommand.
Reproduction
Register a second connection at runtime (db::manager().add_connection("ws4", ..)), then try to run the framework's migrations or seeders against it from application code. The CLI does it (migrate --database=ws4); there is no public API entry point to do the same from a command or a test.
(I'm on laravel-rust 0.1.4, Rust 2024, MySQL.)
- Dominant language
- Rust
- Stars
- 847
- Forks
- 174
- Avg merge
- 5h 40m
- Merged PRs (30d)
- 167
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from laravel/rust-framework
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
laravel/rust-framework#864 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 64/100
laravel/rust-framework#876 ·
Maintainers usually reply within 1 day
-
Case-sensitive contains, starts_with and ends_with that match % and _ literally on every databaseOpen
Difficulty 4/5 3-5 days Newbie friendliness 58/100
laravel/rust-framework#874 ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
laravel/rust-framework#873 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 58/100
laravel/rust-framework#872 ·
Maintainers usually reply within 1 day
All issues in laravel/rust-framework
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
neuralmagic/crucible#579 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
eclipse-score/kyron#249 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
seanmonstar/reqwest#3157 ·
Maintainers usually reply within 2 days