Hello.
I'm a new poster to this list, and I find this topic fascinating.
Tim Starling escribió:
Yes. We already have some degree of abstraction in our SQL files in the form of comments like /*$wgDBTableOptions*/. I'm not sure what the best way to do it is, but here are my ideas:
- Extend that comments system
- Introduce an SQL-like language that can be translated to real SQL
- Introduce an entirely new data definition language, say XML-based
I believe a better solution is to design a domain-specific language, an idea not very different from your first one. This DSL would model the interaction between the application and the DB as it is now, and would be designed to evolve. That's it.
Your other ideas aim to more general-purpose solutions. I believe those would be harder to develop, more complex, and not as useful.
The idea of 1 is to maintain backwards compatibility for scripts that want to feed SQL files directly into a MySQL database. But it's the least flexible because it would get really ugly really fast as you add more features.
If the DSL is well designed, new features would potentially require new domain-specific language elements to be added, and none to be removed. If it is badly designed, however, the end result is usually like you describe. But it's not an inescapable end.
If you like the idea, I can develop a throwaway testbed for an embryonic DSL, to clearly see if it is suitable.
Best regards.