S
S
StrangeAttractor2016-09-19 13:27:43
SQL
StrangeAttractor, 2016-09-19 13:27:43

Is there a simplified DBMS-independent language for describing the structure of a relational database?

Sometimes you want to quickly outline the database structure for a simple CRUD application, but too lazy to write all these CREATE TABLEs and all that in SQL, which, moreover, will only be suitable for one particular DBMS (SQL dialect). I would like something simple and concise and compiled into the dialect of any DBMS, and maybe at the same time into model code blanks for many languages ​​/ ORM. For example, I came up with such an option offhand, we will describe, for example, the basis of relationships between people, the meaning, I think, is intuitive:

people
    pk: id int
    c: name varchar (45)
    c: surname varchar (45)

relations
    pk: id int
    c: name varchar (45) ["firend", "spouse", "boss"] 

relationships
    fk: person1 ~ people -> id
    fk: person2 ~ people -> id
    fk: relation ~ relations -> id
    c: since dt

First, as usual, the idea came to write the parser myself (the above syntax, of course, is not final (and the example is sucked from the finger), there is still a lot to think about, but this is so, the first draft), and then the bright idea came to ask if already something like that.
PS: I know about the code-first options provided by various ORMs, but I want something that is not tied to a specific ORM and a specific programming language.
UPDATE: Because there was no ready-made solution, I wrote such a thing myself. Cultivate, lay out, arrange as an answer. Who needs to subscribe.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2016-09-19
Protko @Fesor

yuml.me , you can try to build a data model in UML with the local DSL.
You can also look for some tool for organizing migrations that support schema description in yaml.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question