| 1 |  |  package liquibase.snapshot.jvm; | 
  | 2 |  |   | 
  | 3 |  |  import liquibase.database.Database; | 
  | 4 |  |  import liquibase.database.core.MSSQLDatabase; | 
  | 5 |  |  import liquibase.database.structure.ForeignKeyConstraintType; | 
  | 6 |  |  import liquibase.exception.DatabaseException; | 
  | 7 |  |   | 
  | 8 | 0 |  public class MSSQLDatabaseSnapshotGenerator extends JdbcDatabaseSnapshotGenerator { | 
  | 9 |  |      public boolean supports(Database database) { | 
  | 10 | 0 |          return database instanceof MSSQLDatabase; | 
  | 11 |  |      } | 
  | 12 |  |   | 
  | 13 |  |      public int getPriority(Database database) { | 
  | 14 | 0 |          return PRIORITY_DATABASE; | 
  | 15 |  |      } | 
  | 16 |  |   | 
  | 17 |  |      @Override | 
  | 18 |  |      protected String convertTableNameToDatabaseTableName(String tableName) { | 
  | 19 | 0 |          return tableName; | 
  | 20 |  |      } | 
  | 21 |  |   | 
  | 22 |  |      @Override | 
  | 23 |  |      protected String convertColumnNameToDatabaseTableName(String columnName) { | 
  | 24 | 0 |          return columnName; | 
  | 25 |  |      } | 
  | 26 |  |   | 
  | 27 |  |       | 
  | 28 |  |   | 
  | 29 |  |   | 
  | 30 |  |   | 
  | 31 |  |   | 
  | 32 |  |   | 
  | 33 |  |   | 
  | 34 |  |   | 
  | 35 |  |      @Override | 
  | 36 |  |      protected ForeignKeyConstraintType convertToForeignKeyConstraintType(int jdbcType) throws DatabaseException { | 
  | 37 |  |   | 
  | 38 | 0 |          if (jdbcType == 0) { | 
  | 39 | 0 |              return ForeignKeyConstraintType.importedKeyCascade; | 
  | 40 | 0 |          } else if (jdbcType == 1) { | 
  | 41 | 0 |              return ForeignKeyConstraintType.importedKeyNoAction; | 
  | 42 | 0 |          } else if (jdbcType == 2) { | 
  | 43 | 0 |              return ForeignKeyConstraintType.importedKeySetNull; | 
  | 44 |  |          } else { | 
  | 45 | 0 |              throw new DatabaseException("Unknown constraint type: " + jdbcType); | 
  | 46 |  |          } | 
  | 47 |  |      } | 
  | 48 |  |   | 
  | 49 |  |  } |