Spring boot not creating schema correctly?
<p>I have very simple spring boot app which is using h2 database on local. I have schema-h2.sql which has below script -</p>

<pre><code>CREATE TABLE USERS(
  userid NUMBER(10,0) AUTO_INCREMENT PRIMARY KEY,
  email   VARCHAR(256) UNIQUE NOT NULL,
  fname   VARCHAR(256),
  lname   VARCHAR(256)
);
</code></pre>

<p>And in application-default.properties -</p>

<pre><code>spring.h2.console.enabled=true
spring.datasource.platform=h2
</code></pre>

<p><code>spring.datasource.url=jdbc:h2:mem:testdb;MODE=MSSQLServer;DB_CLOSE_DELAY=-1;DB_CLO SE_ON_EXIT=false</code></p>

<p>When I look at /h2-console, I can see table being created but it is missing unique constraint on email column.</p>

<p>I even tried adding alter statement in schema-h2.sql script to create constraint but that doesn't work either -</p>

<pre><code>ALTER TABLE USERS ADD CONSTRAINT UQ_EMAIL UNIQUE(email);
</code></pre>

<p>Also, when run those script in h2-console it creates unique constraint correctly so it does seem like something to do with how spring executes them. </p>

<p>When debugging I can see that Alter statement gets executed without any exception in ScriptUtils class.</p>

<p>Not sure how to take this forward so any help will be greatly appreciated.</p>