From d80bbff82a2deda1b66b30754d08d25c0a4f5e85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=96=8C?= <253498229@qq.com> Date: Tue, 10 Dec 2019 09:45:34 +0800 Subject: [PATCH] =?UTF-8?q?fix-=E7=94=9F=E6=88=90=E7=9A=84sql=E4=B8=BAnull?= =?UTF-8?q?=E7=9A=84=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/cn/codeforfun/migrate/core/diff/DiffResult.java | 2 +- .../src/test/java/cn/codeforfun/migrate/core/MigrateTest.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/mysql-migrate/src/main/java/cn/codeforfun/migrate/core/diff/DiffResult.java b/mysql-migrate/src/main/java/cn/codeforfun/migrate/core/diff/DiffResult.java index b10be67..090f634 100644 --- a/mysql-migrate/src/main/java/cn/codeforfun/migrate/core/diff/DiffResult.java +++ b/mysql-migrate/src/main/java/cn/codeforfun/migrate/core/diff/DiffResult.java @@ -48,7 +48,7 @@ public List getSqlList() { if (ObjectUtils.isEmpty(this.delete) && ObjectUtils.isEmpty(this.create) && ObjectUtils.isEmpty(this.update)) { - return null; + return new ArrayList<>(); } log.debug("开始生成sql..."); resolveDeleteSql(); diff --git a/mysql-migrate/src/test/java/cn/codeforfun/migrate/core/MigrateTest.java b/mysql-migrate/src/test/java/cn/codeforfun/migrate/core/MigrateTest.java index 1261f7c..64434e1 100644 --- a/mysql-migrate/src/test/java/cn/codeforfun/migrate/core/MigrateTest.java +++ b/mysql-migrate/src/test/java/cn/codeforfun/migrate/core/MigrateTest.java @@ -32,7 +32,9 @@ public void diff() throws SQLException { Migrate migrate = new Migrate().from(from).to(to); DiffResult diffResult = migrate.diff(); List sql = diffResult.getSqlList(); - System.out.println(sql); + for (String s : sql) { + System.out.println(s); + } } @Test