package liquibase.ext.sequencetable.change;

import liquibase.change.AbstractChange;
import liquibase.change.ChangeMetaData;
import liquibase.change.DatabaseChange;
import liquibase.database.Database;
import liquibase.statement.SqlStatement;
import liquibase.statement.core.DropTableStatement;

import java.math.BigInteger;

@DatabaseChange(name="dropSequenceTable",
description = "Drop the table used to generate sequence values if the database does not support sequences",
priority = ChangeMetaData.PRIORITY_DEFAULT)
public class DropSequenceTableChange extends AbstractChange {

	private String catalogName;
	private String schemaName;
	private String tableName;
	private boolean alwaysUse = false;

	public String getCatalogName() {
		return catalogName;
	}

	public void setCatalogName(String catalogName) {
		this.catalogName = catalogName;
	}

	public String getSchemaName() {
		return schemaName;
	}

	public void setSchemaName(String schemaName) {
		this.schemaName = schemaName;
	}

	public String getTableName() {
		return tableName;
	}

	public void setTableName(String tableName) {
		this.tableName = tableName;
	}

	public boolean isAlwaysUse() {
		return alwaysUse;
	}

	public void setAlwaysUse(boolean alwaysUse) {
		this.alwaysUse = alwaysUse;
	}

	@Override
	public String getConfirmationMessage() {
		return "Sequence table "+tableName+" dropped";
	}

	@Override
	public SqlStatement[] generateStatements(Database database) {


		if (alwaysUse || !database.supportsSequences()) {
			DropTableStatement tblStmt = new DropTableStatement(this.catalogName, this.schemaName, this.tableName, false);

			return new SqlStatement[] {
					tblStmt,
			};
		} else {
			return new SqlStatement[0];
		}
	}
}

@@ -292,37 +292,8 @@
 t;%0A%0A
-import java.math.BigInteger;%0A
 %0A@Da
@@ -546,17 +546,20 @@
 ange %7B%0A%0A
-%09
+    
 private 
@@ -574,25 +574,28 @@
 atalogName;%0A
-%09
+    
 private Stri
@@ -605,25 +605,28 @@
 schemaName;%0A
-%09
+    
 private Stri
@@ -639,17 +639,20 @@
 leName;%0A
-%09
+    
 private 
@@ -679,17 +679,20 @@
 false;%0A%0A
-%09
+    
 public S
@@ -712,26 +712,32 @@
 logName() %7B%0A
-%09%09
+        
 return catal
@@ -740,29 +740,35 @@
 atalogName;%0A
-%09%7D%0A%0A%09
+    %7D%0A%0A    
 public void 
@@ -800,26 +800,32 @@
 alogName) %7B%0A
-%09%09
+        
 this.catalog
@@ -840,29 +840,35 @@
 atalogName;%0A
-%09%7D%0A%0A%09
+    %7D%0A%0A    
 public Strin
@@ -883,26 +883,32 @@
 emaName() %7B%0A
-%09%09
+        
 return schem
@@ -910,29 +910,35 @@
 schemaName;%0A
-%09%7D%0A%0A%09
+    %7D%0A%0A    
 public void 
@@ -968,26 +968,32 @@
 hemaName) %7B%0A
-%09%09
+        
 this.schemaN
@@ -1006,29 +1006,35 @@
 schemaName;%0A
-%09%7D%0A%0A%09
+    %7D%0A%0A    
 public Strin
@@ -1048,26 +1048,32 @@
 bleName() %7B%0A
-%09%09
+        
 return table
@@ -1074,29 +1074,35 @@
  tableName;%0A
-%09%7D%0A%0A%09
+    %7D%0A%0A    
 public void 
@@ -1130,26 +1130,32 @@
 ableName) %7B%0A
-%09%09
+        
 this.tableNa
@@ -1170,21 +1170,27 @@
 leName;%0A
-%09%7D%0A%0A%09
+    %7D%0A%0A    
 public b
@@ -1208,26 +1208,32 @@
 waysUse() %7B%0A
-%09%09
+        
 return alway
@@ -1238,21 +1238,27 @@
 aysUse;%0A
-%09%7D%0A%0A%09
+    %7D%0A%0A    
 public v
@@ -1295,18 +1295,24 @@
 sUse) %7B%0A
-%09%09
+        
 this.alw
@@ -1331,21 +1331,27 @@
 aysUse;%0A
-%09%7D%0A%0A%09
+    %7D%0A%0A    
 @Overrid
@@ -1344,33 +1344,36 @@
 %0A%0A    @Override%0A
-%09
+    
 public String ge
@@ -1397,18 +1397,24 @@
 age() %7B%0A
-%09%09
+        
 return %22
@@ -1456,13 +1456,19 @@
 d%22;%0A
-%09%7D%0A%0A%09
+    %7D%0A%0A    
 @Ove
@@ -1473,17 +1473,20 @@
 verride%0A
-%09
+    
 public S
@@ -1541,18 +1541,24 @@
 se) %7B%0A%0A%0A
-%09%09
+        
 if (alwa
@@ -1599,19 +1599,28 @@
 es()) %7B%0A
-%09%09%09
+            
 DropTabl
@@ -1723,19 +1723,28 @@
 alse);%0A%0A
-%09%09%09
+            
 return n
@@ -1767,42 +1767,81 @@
 %5D %7B%0A
-%09%09%09%09%09tblStmt,%0A%09%09%09%7D;%0A%09%09%7D else %7B%0A%09%09%09
+                    tblStmt,%0A            %7D;%0A        %7D else %7B%0A            
 retu
@@ -1868,13 +1868,22 @@
 0%5D;%0A
-%09%09%7D%0A%09
+        %7D%0A    
 %7D%0A%7D%0A

revert space changes remove unused import