Skip to content

Conversation

tk0miya
Copy link
Collaborator

@tk0miya tk0miya commented Aug 23, 2025

To ensure consistency between the database schema and the generated
types, this adds a new feature that rbs_rails stops to generate types
for models if the database is not migrated to the latest version.

This feature can be configured via check_db_migrations settings.

Thanks to @sinsoku

Example:

$ bundle exec rbs_rails models
Error:

Migrations are pending. To resolve this issue, run:

        bin/rails db:migrate

You have 1 pending migration:

db/migrate/20250812173612_add_email_to_users.rb

Note: this contains #337.

So far, our testcases build RBS signatures from scratch every time.  It
is slow and unnecessary.

This introduces a mechanism to share the built signatures across tests.

Before:

```
Finished in 99.189478s, 0.2016 runs/s, 0.1815 assertions/s.

20 runs, 18 assertions, 0 failures, 0 errors, 0 skips
```

After:

```
Finished in 25.321047s, 0.7899 runs/s, 0.7109 assertions/s.

20 runs, 18 assertions, 0 failures, 0 errors, 0 skips
```
To ensure consistency between the database schema and the generated
types, this adds a new feature that rbs_rails stops to generate types
for models if the database is not migrated to the latest version.

This feature can be configured via `check_db_migrations` settings.

Thanks to @sinsoku

Example:

```
$ bundle exec rbs_rails models
Error:

Migrations are pending. To resolve this issue, run:

        bin/rails db:migrate

You have 1 pending migration:

db/migrate/20250812173612_add_email_to_users.rb
```
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