SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

The Master of the Schema

By Steve Jones,

"The database ... should be the master of the schema".

It's not often I see an application developer talk about the importance of the database, or at least that the database (and data) are very important to the success of the application, but in this case, that's what I saw. The quote is from this blog, which talks about the problems of the code first approach to building an application. It's from a Java development company, though it's their jooQ product blog that actually generates Java code from the database, so they get the need to pay some attention to the database.

The thrust of the article is that using an ORM is fine, but this isn't necessarily the best way to design your datastore if you need a relational system. There will be mistakes made in naming objects, in structuring them and ensuring indexes exist and more. The longer you go with generated database code from some code-first type system, the more issues you might have later as you try to modify both the application and database, especially the database, since you can't drop it and recreate it.

If we could drop the tables and rebuild them, life would be great. Maybe we should keep copies of data on the clients, and just reload the necessary data after a deployment... It would make my life easier as a database professional, but I suspect this isn't the best way to ensure data quality and consistency (not to mention completeness).

I agree that if you're building an application, you should go database first. At least start with some basic structures and learn to modify them. The practice you get modifying code, with scripts not GUIs, will be invaluable later to both developers and DBAs/admins. You'll start getting practice and understand what it means to deploy scripts to your database. After all, making schema changes with scripts in your development database is the first "practice" you get for deployment. If you can't get the scripts to work here, how would you have any confidence they'll work in production?

Total article views: 70 | Views in the last 30 days: 1
Related Articles

Script Application Roles

I need to script out database and application roles for databases on one


Drop Common User in Application database

Run the output of the following script in master database to drop common user in all the application...


Multi-Script, Multi-DB Deployments

A way to handle application releases involving multiple scripts and/or multiple databases.


First SQL Database

First Sql Database


The Red Gate Guide to SQL Server Team-based Development

This book shows how to use of mixture of home-grown scripts, native SQL Server tools, and tools fro...

database design