How do you create and update your SQL scripts?

I am wondering what is the best way to create and maintain SQL database maps and scripts. I know that I am more a fan of writing SQL script manually in a text editor (plus designing the map next to me on a piece of paper), while others prefer to use database map software (MySQL Workbench, Visual Studio ... some of them listed in this post ) to automatically generate a script.

Both solutions have advantages and disadvantages. I see these advantages:

  • Manual SQL script:
    • You know exactly what you are writing.
    • You can save clean and easy to read SQL code.
    • Writing code allows you to better see the specifics of your database.
    • Writing code allows you to practice SQL knowledge.
  • Automatically generated script from a designed map:
    • Saves time.
    • Even without knowing the SQL language, you can create a script (even if I listed this as the opposite advantage for a SQL script manually).
    • Prevents typos.

What do you think, how are you progressing?

+5
source share
1 answer

If automation is saving time and human error, why not do it? I would try to auto generate SQL if:

  • I already filled the test database and organically built the schema by writing and executing special SQL queries that I did not track; and

, , SQL.

- , (, ). , .

, , , .

, , - , script , , . - :

INSERT INTO DB_VERSION (upgrade_time, version_from, version_to, comment)
    VALUES ('2011-07-04T120320', '2.2.4', '2.3', 'add column x to table y.')
+7

All Articles