Opt-out of EF / Code-First Migrations and use raw SQL scripts instead

Hi,

We are currently using ServiceStack with OrmLite in our application. Some of the built-in ServiceStack features (such as Auth, APIKeysFeature, DatabaseJobFeature, etc.) default to using EF (Entity Framework) or OrmLite Code-First migration classes to automatically generate and maintain their required database tables.

However, our DBAs do not want our application to manage database schema updates at runtime or use code-first migrations for these tables. Instead, our team strictly relies on raw SQL scripts executed externally to manage and maintain all database schemas.

I currently enable all features from a template and get the DDLs from generated tables in SQL Server but I was wondering if there is another way.

When a feature like ApiKeysFeature has a new table definition for a new version, do you provide that information in the release note?

Thank you!

All plugins that require tables are created within their InitSchema() method, so you can just comment out that call in any plugin to prevent any schema changes:

var feature = appHost.GetPlugin<ApiKeysFeature>();
// feature.InitSchema(db);

But it’s rare for plugins to require schema changes (can’t recall a time when it was needed), it’s purpose has been to create the table if it doesn’t exist already.