コード例 #1
0
 protected Snapshot getExistingSnapshot(Scope scope)
     throws liquibase.exception.ActionPerformException {
   Snapshot existingSnapshot = new Snapshot(scope);
   existingSnapshot.add(
       scope.getSingleton(SnapshotFactory.class).snapshot(this.changeLogTable, scope));
   existingSnapshot.addAll(
       scope
           .getSingleton(SnapshotFactory.class)
           .snapshotAll(Column.class, this.changeLogTable, scope));
   return existingSnapshot;
 }
コード例 #2
0
  protected Snapshot createWantedSnapshot(Scope scope) {
    Database database = scope.getDatabase();
    Table wantedVersionTable = new Table(this.changeLogTable.name, this.changeLogTable.getSchema());
    wantedVersionTable.tablespace = changeLogTablespace;
    Collection<Column> wantedVersionColumns = new ArrayList<>();

    wantedVersionColumns.add(
        new Column(
            "id",
            this.changeLogTable,
            new DataType(getCharType(scope), getColumnSize("id", scope)),
            false));
    wantedVersionColumns.add(
        new Column(
            "author",
            this.changeLogTable,
            new DataType(getCharType(scope), getColumnSize("author", scope)),
            false));
    wantedVersionColumns.add(
        new Column(
            "filename",
            this.changeLogTable,
            new DataType(getCharType(scope), getColumnSize("filename", scope)),
            false));
    wantedVersionColumns.add(
        new Column(
            "dateexecuted", this.changeLogTable, new DataType(getDateTimeType(scope)), false));
    wantedVersionColumns.add(
        new Column(
            "orderexecuted",
            this.changeLogTable,
            new DataType(DataType.StandardType.INTEGER),
            false));
    wantedVersionColumns.add(
        new Column(
            "exectype",
            this.changeLogTable,
            new DataType(getCharType(scope), getColumnSize("exectype", scope)),
            false));

    wantedVersionColumns.add(
        new Column(
            "md5sum",
            this.changeLogTable,
            new DataType(getCharType(scope), getColumnSize("md5sum", scope)),
            true));
    wantedVersionColumns.add(
        new Column(
            "description",
            this.changeLogTable,
            new DataType(getCharType(scope), getColumnSize("description", scope)),
            true));
    wantedVersionColumns.add(
        new Column(
            "comments",
            this.changeLogTable,
            new DataType(getCharType(scope), getColumnSize("comments", scope)),
            true));
    wantedVersionColumns.add(
        new Column(
            "tag",
            this.changeLogTable,
            new DataType(getCharType(scope), getColumnSize("tag", scope)),
            true));
    wantedVersionColumns.add(
        new Column(
            "liquibase",
            this.changeLogTable,
            new DataType(getCharType(scope), getColumnSize("liquibase", scope)),
            true));
    wantedVersionColumns.add(
        new Column(
            "labels",
            this.changeLogTable,
            new DataType(getCharType(scope), getColumnSize("labels", scope)),
            true));
    wantedVersionColumns.add(
        new Column(
            "contexts",
            this.changeLogTable,
            new DataType(getCharType(scope), getColumnSize("contexts", scope)),
            true));
    wantedVersionColumns.add(
        new Column(
            "deployment_id",
            this.changeLogTable,
            new DataType(getCharType(scope), getColumnSize("deployment_id", scope)),
            true));

    boolean upperCase =
        database.getIdentifierCaseHandling(Table.class, false, scope)
            != Database.IdentifierCaseHandling.LOWERCASE;
    for (Column column : wantedVersionColumns) {
      if (upperCase) {
        column.name = column.name.toUpperCase();
      }
    }
    Snapshot wantedVersionSnapshot = new Snapshot(scope);
    wantedVersionSnapshot.add(wantedVersionTable);
    wantedVersionSnapshot.addAll(wantedVersionColumns);
    return wantedVersionSnapshot;
  }