Skip to content

Commit

Permalink
- Lowercase liquibase changeset names.
Browse files Browse the repository at this point in the history
- Minor version bump.
  • Loading branch information
jjzazuet committed Jan 19, 2023
1 parent 2815ff8 commit e2556da
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ subprojects {
apply(plugin = "io.vacco.oss.gitflow")

group = "io.vacco.metolithe"
version = "2.8.0"
version = "2.8.1"

configure<io.vacco.oss.gitflow.GsPluginProfileExtension> { addClasspathHell() }
configure<io.vacco.cphell.ChPluginExtension> { resourceExclusions.add("module-info.class") }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ private AddColumn mapNonPkAttribute(MtDescriptor<?> d, MtFieldDescriptor fd) {

private ChangeSet mapIndex(MtDescriptor<?> d, MtFieldDescriptor fm) {
var idx = new CreateIndex();
idx.indexName = d.getFormat().of(format("idx-%s-%s", d.getName(), fm.getFieldName()));
idx.indexName = d.getFormat().of(format("idx_%s_%s", d.getName(), fm.getFieldName()));
idx.tableName = d.getName();
idx.columns.add(new Column().withName(fm.getFieldName()));
return new ChangeSet().withId(idx.indexName).add(idx);
Expand All @@ -70,7 +70,8 @@ private ChangeSet mapCompositeIndex(String indexName, MtDescriptor<?> d, List<Mt
var fields = components.stream()
.sorted(comparingInt(fd -> fd.get(MtCompIndex.class).get().idx()))
.map(MtFieldDescriptor::getFieldName).toArray();
var indexId = format("idx-%s-%s", indexName, Integer.toHexString(hash32(toStringConcat(fields).get(), DEFAULT_SEED)));
var hash = Integer.toHexString(hash32(toStringConcat(fields).get(), DEFAULT_SEED));
var indexId = format("idx_%s_%s", indexName, hash);
var idx = new CreateIndex()
.withIndexName(d.getFormat().of(indexId))
.withTableName(d.getName());
Expand All @@ -83,7 +84,7 @@ private ChangeSet mapCompositeIndex(String indexName, MtDescriptor<?> d, List<Mt
private ChangeSet mapUniqueConstraint(MtDescriptor<?> d) {
var uc = new AddUniqueConstraint();
uc.tableName = d.getName();
uc.constraintName = d.getFormat().of(format("unq-%s", d.getName()));
uc.constraintName = d.getFormat().of(format("unq_%s", d.getName()));
uc.columnNames = d.get(MtUnique.class)
.sorted(comparingInt(fd -> fd.get(MtUnique.class).get().idx()))
.map(MtFieldDescriptor::getFieldName).collect(joining(","));
Expand All @@ -106,7 +107,8 @@ private AddForeignKeyConstraint mapForeignKey(MtDescriptor<?> d, MtFieldDescript
var fromField = fd.getFieldName();
var to = fkTarget.getName();
var toField = targetPk.getFieldName();
var fkId = format("fk-%s", Integer.toHexString(hash32(toStringConcat(from, fromField, to, toField).get(), DEFAULT_SEED)));
var hash = Integer.toHexString(hash32(toStringConcat(from, fromField, to, toField).get(), DEFAULT_SEED));
var fkId = format("fk_%s", hash);

var fkc = new AddForeignKeyConstraint();
fkc.baseColumnNames = fromField;
Expand All @@ -127,13 +129,13 @@ private List<ChangeSet> mapForeignKeys(List<OxVtx<String, MtDescriptor<?>>> clas
}

private ChangeSet mapTableColumn(MtDescriptor<?> d, MtFieldDescriptor fd) {
var cs = new ChangeSet().withId(String.format("tbl-col-%s-%s", d.getName(), fd.getFieldName()));
var cs = new ChangeSet().withId(String.format("tbl_col_%s_%s", d.getName(), fd.getFieldName()));
cs.add(mapNonPkAttribute(d, fd));
return cs;
}

private ChangeSet mapTable(MtDescriptor<?> d) {
var cs = new ChangeSet().withId(String.format("tbl-%s", d.getName()));
var cs = new ChangeSet().withId(String.format("tbl_%s", d.getName()));
var ct = new CreateTable().withTableName(d.getName());
cs.changes.add(ct);
d.get(MtPk.class).findFirst()
Expand Down

0 comments on commit e2556da

Please sign in to comment.