I have the following in my application-context.xml :
<bean id="ds" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/test"/>
<property name="username" value="robinsuri"/>
<property name="password" value=""/>
Now i am making update and insert queries to a table called snippets
in the test db
What i want is to have a mechanism to make sure that the table snippets is present and has the same expected schema.
So if the database itself is not present then i create a database and then create the table with a particular schema.
Otherwise if the database is present and table is not there then i create a table with the schema.
And if the table is also present and doesnot match the schema i return some error .
The schema for which i have to implement this is :
id char(36) NO PRI NULL
text text NO NULL
title varchar(255) NO NULL
mode varchar(255) NO NULL
I am also attaching a csv file giving the schema.