Skip to content

Add SMTP migration#187

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

Add SMTP migration#187
premtsd-code wants to merge 4 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 project SMTP configuration as a new Settings resource type, completing the pattern established by Protocols, Labels, and Services. The source reads the typed Project model fields; the destination performs a read-then-merge on the platform projects document so the destination's stored password is preserved (the source API never exposes it).

  • SMTP resource class, TYPE_SMTP constant, and entries in GROUP_SETTINGS_RESOURCES / ALL_PUBLIC_RESOURCES follow the singleton-resource pattern exactly.
  • exportSMTP error handling uses the correct (int) $e->getCode() ?: Exception::CODE_INTERNAL form, consistent with all sibling exporters.
  • createSMTP mirrors createProtocols (read-merge-update via dbForPlatform) with the intentional omission of the password field, documented in both the docblock and PR description.

Confidence Score: 5/5

Safe to merge — the change is a self-contained singleton resource that follows an established pattern with no regressions to existing functionality.

The implementation is structurally identical to the existing Protocols/Labels/Services singleton migrations. Error handling, status reporting, read-then-merge destination writes, and registration in Transfer/Resource constants are all consistent with the rest of the codebase. The password-omission limitation is documented and intentional.

No files require special attention.

Important Files Changed

Filename Overview
src/Migration/Resources/Settings/SMTP.php New singleton resource class for SMTP settings; well-typed, correctly omits password, consistent with other Settings resource classes.
src/Migration/Sources/Appwrite.php Adds exportSMTP() and report counting; error handling uses the correct (int) cast + CODE_INTERNAL fallback, consistent with all sibling singleton exporters.
src/Migration/Destinations/Appwrite.php createSMTP follows the same read-then-merge pattern used by createProtocols; imports TYPE_SMTP and dispatches correctly in importSettingsResource.
src/Migration/Resource.php Adds TYPE_SMTP constant and registers it in the all-types list; placement is correct.
src/Migration/Transfer.php Adds TYPE_SMTP to GROUP_SETTINGS_RESOURCES and ALL_PUBLIC_RESOURCES; consistent with other settings singleton types.

Reviews (3): Last reviewed commit: "Normalize error code for SMTP export han..." | 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