Skip to content

Add basic wiki farm support#69

Merged
SomeMWDev merged 2 commits intomainfrom
feat/farm
Mar 11, 2026
Merged

Add basic wiki farm support#69
SomeMWDev merged 2 commits intomainfrom
feat/farm

Conversation

@SomeMWDev
Copy link
Owner

@SomeMWDev SomeMWDev commented Feb 15, 2026

Summary by CodeRabbit

  • New Features

    • Added farm install command to create and configure wiki databases with automatic privilege setup.
  • Documentation

    • Updated README with installation instructions for the Rust version.
    • Added guidance on running the tool and PATH configuration steps.

@SomeMWDev SomeMWDev added the enhancement New feature or request label Feb 15, 2026
@coderabbitai
Copy link

coderabbitai bot commented Feb 15, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7b908624-e7ac-492b-aadf-ee1f0d96df1c

📥 Commits

Reviewing files that changed from the base of the PR and between bd3e9a1 and c116a8b.

📒 Files selected for processing (6)
  • rs/README.md
  • rs/src/main.rs
  • rs/src/modules/db.rs
  • rs/src/modules/farm.rs
  • rs/src/modules/mod.rs
  • rs/src/modules/reset.rs

📝 Walkthrough

Walkthrough

Adds a new farm CLI module to create and prepare wiki databases, wires it into CLI dispatch, refactors DB drop/reset routines to accept explicit database names, and updates README with installation instructions for the Rust rewrite. (≤50 words)

Changes

Cohort / File(s) Summary
Documentation
rs/README.md
Added Installation steps, updated wording to state the Rust rewrite replaces the Python version, and added PATH fallback note.
CLI Entry & Module Registration
rs/src/main.rs, rs/src/modules/mod.rs
Imported FarmArgs, added Modules::Farm(FarmArgs) variant and dispatch arms; registered pub(crate) mod farm;.
Farm feature
rs/src/modules/farm.rs
New module exposing FarmArgs, FarmCommand, InstallArgs, and execute(config, farm_args); implements install flow: validate db name, create DB, grant privileges, print progress, and call reset.
Database helpers
rs/src/modules/db.rs
Added pub fn drop_database(config: &MWUtilConfig, db: &str) and updated drop_mw_database to call it with resolved name.
Reset refactor
rs/src/modules/reset.rs
Introduced reset_default_database(config), changed signature to reset_database(config, db, new), updated logic to operate on provided db, and adjusted flow for update/recreate when invoked after install.

Sequence Diagram

sequenceDiagram
    participant User
    participant CLI as CLI Handler
    participant Farm as Farm Module
    participant DB as Database
    participant Reset as Reset Module

    User->>CLI: run `mwutil farm install --db <name>`
    CLI->>Farm: execute(config, FarmArgs)
    Farm->>Farm: validate db_name ends with "wiki"
    alt valid
        Farm->>DB: CREATE DATABASE IF NOT EXISTS `<db>`
        DB-->>Farm: success/failure
        Farm->>DB: GRANT ALL PRIVILEGES ON `<db>`.* TO `<user>`
        DB-->>Farm: success/failure
        Farm-->>CLI: print "Created database."
        Farm->>Reset: reset_database(config, <db>, true)
        Reset->>DB: run update script (--wiki, --quick)
        alt new == false
            Reset->>DB: run recreate step
            DB-->>Reset: recreate result
        end
        Reset-->>Farm: reset result
        Farm-->>CLI: exit success
    else invalid
        Farm-->>CLI: exit error "db_name must end with 'wiki'"
    end
    CLI-->>User: show result
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐰 I dug a little farm in code tonight,

Planted a wiki, made its rights take flight,
Grants were given, resets danced in tune,
Databases hum beneath the moon,
Hooray — the deploy carrots gleam so bright! 🌾✨

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/farm

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@SomeMWDev SomeMWDev marked this pull request as ready for review March 11, 2026 00:30
@SomeMWDev SomeMWDev merged commit a54e61b into main Mar 11, 2026
4 of 5 checks passed
@SomeMWDev SomeMWDev deleted the feat/farm branch March 11, 2026 00:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant