I have and application which uses database internally without any ORM (plain old sql-scripts against JDBC).
But the problem is I don't have actual database.
Is it possible to reconstruct database schema based on this SQL-scripts? The tool that will parse the source code, find SQL-scripts, determine which table contains which datatype and output a script to create database.
I know that it looks not real, but maybe someone stumbled upon the tool like this. Thanks!
If the sql scripts are all selects, inserts, updates etc rather than creates etc then no you almost certainly won't be able to create an exact schema.
For a start how do you know if the sql scripts you have cover every field and every table in the schema. And even if they do, you may be able to get some of the information required to construct some of the tables but you will be hard pressed to get the exact data type/field widths etc for every field in every table.
Wayan Saryada wrote:How many tables you have to create for this program?
~15 tables with ~10 fields each. It's not precise values because as Tony mentioned, the scripts may not cover all the fields.
Tony Docherty wrote:you may be able to get some of the information required to construct some of the tables but you will be hard pressed to get the exact data type/field widths etc for every field in every table.
So the best solution would be to run the app, see what fields are required, modify schema, drop-create table, run again to see if the script run successfully? That's crazy, but the only way I see to solve this problem.