Draw table sketches and we turn them into SQL INSERT Statements like magic. Integration tests with relational databases will never be a pain again.
@person
-----------------------
id | name | age |
-----------------------
1 Enuar 21
2 Gaby 23
3 Yman 26
-----------------------
INSERT INTO person(id,name,age) VALUES(1,'Enuar',21);
INSERT INTO person(id,name,age) VALUES(2,'Gaby',23);
INSERT INTO person(id,name,age) VALUES(3,'Yman',26);
DrawSQL.Builder builder = new DrawSQL.Builder();
DrawSQL drawSQL = builder.fromSketch(new File("your_sketch_file_path")).build();
String generatedSql = drawSQL.getSQL(); //This will return the generated SQL.
drawSQL.apply(jdbcConnection);//This will execute the sql against a JDBC Connection object.
Download JAR File clicking here
...
<repository>
<id>talk-code</id>
<name>maven-repo</name>
<url>https://github.com/talk-code/maven-repo/raw/master</url>
</repository>
...
...
<dependency>
<groupId>mz.co.talkcode</groupId>
<artifactId>DrawSQL</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
...
The first character of a column name should be aligned with its values
@person
-----------------------
id | name | age |
-----------------------
1 Enuar 21
2 Gaby 23
3 Yman 26
-----------------------
@person
-----------------------
id | name | age |
-----------------------
1 Enuar 21
2 Gaby 23
3 Yman 26
-----------------------
@person
------------------------
id | name | age |
------------------------
1 Enuar Ben 21
2 Gaby 23
3 Yman 26
------------------------
@person
------------------------
id | name | age |
------------------------
1 Enuar Ben 21
2 Gaby 23
3 Yman 26
------------------------
-
Columns with whitespaces will be trimmed automatically
-
In case you want to skip trimming and insert whitespace explicitly you have to put a semicolon where it ends.
-
In case you want to have whitespace and semicolon explicitly inserted, you have to put two semicolons.