1 24 package org.riotfamily.revolt.refactor; 25 26 import org.riotfamily.revolt.Dialect; 27 import org.riotfamily.revolt.Refactoring; 28 import org.riotfamily.revolt.Script; 29 import org.riotfamily.revolt.definition.Database; 30 31 35 public class DropForeignKey implements Refactoring { 36 37 private String table; 38 39 private String foreignKey; 40 41 public DropForeignKey() { 42 } 43 44 public DropForeignKey(String table, String foreignKey) { 45 this.table = table; 46 this.foreignKey = foreignKey; 47 } 48 49 public void setTable(String table) { 50 this.table = table; 51 } 52 53 public void setForeignKey(String foreignKey) { 54 this.foreignKey = foreignKey; 55 } 56 57 public void alterModel(Database database) { 58 database.getTable(table).removeForeignKey(foreignKey); 59 } 60 61 public Script getScript(Dialect dialect) { 62 return dialect.dropForeignKey(table, foreignKey); 63 } 64 65 } 66 | Popular Tags |