diff options
author | 2018-02-24 16:54:28 +0300 | |
---|---|---|
committer | 2018-03-15 12:05:59 +0300 | |
commit | bebe7c159f00e6d5a83bb786824d5f32e4de9270 (patch) | |
tree | 151801a2e625d4952d12630da6a4aec6a37fb76d /juick-server-jdbc/src/main/java/com/juick/configuration/DataConfiguration.java | |
parent | 70f481e2fe39a9029b1896d7b351293fd5de4ef8 (diff) |
spring boot wip
Diffstat (limited to 'juick-server-jdbc/src/main/java/com/juick/configuration/DataConfiguration.java')
-rw-r--r-- | juick-server-jdbc/src/main/java/com/juick/configuration/DataConfiguration.java | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/juick-server-jdbc/src/main/java/com/juick/configuration/DataConfiguration.java b/juick-server-jdbc/src/main/java/com/juick/configuration/DataConfiguration.java index 2073c3c0..ee9d0baa 100644 --- a/juick-server-jdbc/src/main/java/com/juick/configuration/DataConfiguration.java +++ b/juick-server-jdbc/src/main/java/com/juick/configuration/DataConfiguration.java @@ -23,8 +23,8 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.PropertySource; import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; +import org.springframework.dao.DuplicateKeyException; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.datasource.DataSourceTransactionManager; import org.springframework.transaction.PlatformTransactionManager; @@ -40,7 +40,6 @@ import java.util.List; */ @Configuration @EnableTransactionManagement -@PropertySource(value = {"classpath:juick.conf"}, ignoreResourceNotFound = true) @ComponentScan(basePackages = {"com.juick.service"}) public class DataConfiguration implements TransactionManagementConfigurer { @Value("${datasource_driver:org.h2.Driver}") @@ -246,18 +245,18 @@ public class DataConfiguration implements TransactionManagementConfigurer { " `cnt` smallint(5) unsigned NOT NULL DEFAULT '0'," + " PRIMARY KEY (`user_id`)" + ")"); - jdbcTemplate.execute("CREATE TABLE `auth` (" + + jdbcTemplate.execute("CREATE TABLE IF NOT EXISTS `auth` (" + " `user_id` int(10) unsigned NOT NULL," + " `protocol` enum('xmpp','email','sms') NOT NULL," + " `account` char(64) NOT NULL," + " `authcode` char(8) NOT NULL" + ")"); - jdbcTemplate.execute("CREATE TABLE `mail` (" + + jdbcTemplate.execute("CREATE TABLE IF NOT EXISTS `mail` (" + " `user_id` int(10) unsigned NOT NULL," + " `hash` char(16) NOT NULL," + " PRIMARY KEY (`user_id`)" + ")"); - jdbcTemplate.execute("CREATE TABLE `usersinfo` (" + + jdbcTemplate.execute("CREATE TABLE IF NOT EXISTS `usersinfo` (" + " `user_id` int(10) unsigned NOT NULL," + " `jid` char(32) DEFAULT NULL," + " `fullname` char(32) DEFAULT NULL," + |