Skip to content

Add SMTP migration#187

Open
premtsd-code wants to merge 7 commits into
add-policies-migrationfrom
add-smtp-migration
Open

Add SMTP migration#187
premtsd-code wants to merge 7 commits into
add-policies-migrationfrom
add-smtp-migration

Conversation

@premtsd-code
Copy link
Copy Markdown
Contributor

Adds the project SMTP configuration as a new settings resource. Source reads via the typed Project::get() model; destination writes the project doc's smtp map directly (read-then-merge to preserve destination password — source API never exposes it). Stacks on top of #186.

Adds a single SMTP settings resource carrying the project's custom SMTP
configuration. Source reads via the typed Project model
(Project::get()->smtp*); destination writes the smtp attribute on the
project document directly, matching the pattern used by the other 5
settings resources.

Password is intentionally not migrated — the source API only exposes
smtpPassword as an empty string (write-only field). The destination's
existing password is preserved via read-then-merge of the smtp map.
@premtsd-code premtsd-code changed the base branch from main to add-policies-migration May 21, 2026 06:39
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 21, 2026

Greptile Summary

This PR adds SMTP configuration as a new singleton migration resource, stacking on top of the policies migration. The source reads SMTP settings via the typed Project::get() model, and the destination uses a read-then-merge pattern so the destination's stored password is never overwritten (since the source API never exposes it).

  • SMTP.php introduces a clean singleton resource class with typed constructor, fromArray, jsonSerialize, and the full set of accessors.
  • Sources/Appwrite.php adds exportSMTP() and wires it into exportGroupIntegrations with proper (int) $e->getCode() ?: Exception::CODE_INTERNAL error handling.
  • Destinations/Appwrite.php adds createSMTP() with the read-then-merge approach and routes it in importIntegrationsResource; Transfer.php and Resource.php register the new type in all expected constants.

Confidence Score: 5/5

Safe to merge; the read-then-merge pattern correctly preserves the destination password, and all routing constants are consistently updated across the five changed files.

The new SMTP path is a straightforward singleton migration: export reads typed model fields directly, import merges only the non-secret fields into the destination document, and the cache is purged after the update. No data-loss or auth boundary issues were found.

src/Migration/Sources/Appwrite.php — minor structural inconsistency in the SMTP try/catch block compared to the other blocks in exportGroupIntegrations.

Important Files Changed

Filename Overview
src/Migration/Resources/Settings/SMTP.php New singleton resource class for project SMTP config; clean model with proper accessors, fromArray, and jsonSerialize.
src/Migration/Sources/Appwrite.php Adds exportSMTP() using typed Project model fields; the new SMTP try/catch block uses inverted nesting (try wrapping the if) compared to the consistent if-wrapping-try pattern used for Platform, API_KEY, and Webhook.
src/Migration/Destinations/Appwrite.php Adds createSMTP() using a correct read-then-merge pattern that preserves the destination password; import routing placed correctly in importIntegrationsResource.
src/Migration/Resource.php Adds TYPE_SMTP constant and registers it in the all-types array; correct placement alongside other integration types.
src/Migration/Transfer.php Adds TYPE_SMTP to GROUP_INTEGRATIONS_RESOURCES and the master resource list; consistent with the new resource's getGroup() return value.

Reviews (6): Last reviewed commit: "Move SMTP into integrations group (exter..." | Re-trigger Greptile

Comment thread src/Migration/Destinations/Appwrite.php
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.

1 participant