Skip to content

refactor: simplify schema migration helpers and remove unused class#1168

Merged
Adammatthiesen merged 3 commits intomainfrom
adam/fix-migrator
Jan 11, 2026
Merged

refactor: simplify schema migration helpers and remove unused class#1168
Adammatthiesen merged 3 commits intomainfrom
adam/fix-migrator

Conversation

@Adammatthiesen
Copy link
Copy Markdown
Member

This pull request refactors and simplifies the schema migration helpers in the @withstudiocms/kysely package. The main improvement is replacing the MigrationSchemaManager class with a functional, Effect-based schemaManager factory, resulting in clearer, more composable code. The changes also include improved error handling and more idiomatic use of the Effect library.

Schema migration helper refactor:

  • Replaced the MigrationSchemaManager class with a schemaManager function that returns composable methods for schema management, resulting in simpler and more functional code (migrator.ts).
  • Updated the implementation of schema loading and saving to use Effect pipelines, with improved error handling and logging for database operations (migrator.ts).
  • Updated usages in syncDatabaseSchema and rollbackMigration to use the new schemaManager instead of the previous class, ensuring consistency across the codebase (migrator.ts). [1] [2]

Minor cleanup:

  • Removed an unused error type import from migrator.ts for clarity.

Changelog:

  • Added a changeset describing the schema migration helper tweaks. (.changeset/eager-hairs-fix.md)

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jan 9, 2026

🦋 Changeset detected

Latest commit: 6394d27

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 17 packages
Name Type
@withstudiocms/kysely Patch
@withstudiocms/sdk Patch
@studiocms/devapps Patch
@studiocms/migrator Patch
studiocms Patch
@studiocms/auth0 Patch
@studiocms/blog Patch
@studiocms/cloudinary-image-service Patch
@studiocms/discord Patch
@studiocms/github Patch
@studiocms/google Patch
@studiocms/html Patch
@studiocms/markdoc Patch
@studiocms/md Patch
@studiocms/mdx Patch
@studiocms/s3-storage Patch
@studiocms/wysiwyg Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 9, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch adam/fix-migrator

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.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Jan 9, 2026

studiocms

npm i https://pkg.pr.new/withstudiocms/studiocms@1168

@studiocms/auth0

npm i https://pkg.pr.new/withstudiocms/studiocms/@studiocms/auth0@1168

@studiocms/blog

npm i https://pkg.pr.new/withstudiocms/studiocms/@studiocms/blog@1168

@studiocms/cloudinary-image-service

npm i https://pkg.pr.new/withstudiocms/studiocms/@studiocms/cloudinary-image-service@1168

@studiocms/devapps

npm i https://pkg.pr.new/withstudiocms/studiocms/@studiocms/devapps@1168

@studiocms/discord

npm i https://pkg.pr.new/withstudiocms/studiocms/@studiocms/discord@1168

@studiocms/github

npm i https://pkg.pr.new/withstudiocms/studiocms/@studiocms/github@1168

@studiocms/google

npm i https://pkg.pr.new/withstudiocms/studiocms/@studiocms/google@1168

@studiocms/html

npm i https://pkg.pr.new/withstudiocms/studiocms/@studiocms/html@1168

@studiocms/markdoc

npm i https://pkg.pr.new/withstudiocms/studiocms/@studiocms/markdoc@1168

@studiocms/md

npm i https://pkg.pr.new/withstudiocms/studiocms/@studiocms/md@1168

@studiocms/mdx

npm i https://pkg.pr.new/withstudiocms/studiocms/@studiocms/mdx@1168

@studiocms/migrator

npm i https://pkg.pr.new/withstudiocms/studiocms/@studiocms/migrator@1168

@studiocms/s3-storage

npm i https://pkg.pr.new/withstudiocms/studiocms/@studiocms/s3-storage@1168

@studiocms/wysiwyg

npm i https://pkg.pr.new/withstudiocms/studiocms/@studiocms/wysiwyg@1168

@withstudiocms/auth-kit

npm i https://pkg.pr.new/withstudiocms/studiocms/@withstudiocms/auth-kit@1168

@withstudiocms/component-registry

npm i https://pkg.pr.new/withstudiocms/studiocms/@withstudiocms/component-registry@1168

@withstudiocms/effect

npm i https://pkg.pr.new/withstudiocms/studiocms/@withstudiocms/effect@1168

@withstudiocms/internal_helpers

npm i https://pkg.pr.new/withstudiocms/studiocms/@withstudiocms/internal_helpers@1168

@withstudiocms/kysely

npm i https://pkg.pr.new/withstudiocms/studiocms/@withstudiocms/kysely@1168

@withstudiocms/sdk

npm i https://pkg.pr.new/withstudiocms/studiocms/@withstudiocms/sdk@1168

commit: 6394d27

@Adammatthiesen Adammatthiesen marked this pull request as ready for review January 9, 2026 11:41
@Adammatthiesen Adammatthiesen requested a review from a team as a code owner January 9, 2026 11:41
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 9, 2026

Allure Test Report for this PR:

Allure Report | History

@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

Base automatically changed from adam/purge-old-changesets to main January 9, 2026 15:13
@Adammatthiesen Adammatthiesen merged commit 9bde767 into main Jan 11, 2026
30 checks passed
@Adammatthiesen Adammatthiesen deleted the adam/fix-migrator branch January 11, 2026 04:51
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.

4 participants