Skip to content

Commit da721c8

Browse files
authored
Merge pull request #12 from entityc/bobgarner/database-transform-bug
Fixed issue with schema not being written properly because an incompl…
2 parents 034733e + 8067601 commit da721c8

File tree

8 files changed

+16
-20
lines changed

8 files changed

+16
-20
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
<dependency>
9191
<groupId>com.google.code.gson</groupId>
9292
<artifactId>gson</artifactId>
93-
<version>2.8.9</version>
93+
<version>2.9.0</version>
9494
</dependency>
9595
<dependency>
9696
<groupId>org.apache.directory.studio</groupId>

src/main/java/org/entityc/compiler/EntityCompiler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252

5353
public class EntityCompiler {
5454

55-
public static final String COMPILER_VERSION = "0.13.0";
55+
public static final String COMPILER_VERSION = "0.13.1";
5656
public static final String LANGUAGE_VERSION = "0.12.3";
5757
private static final Map<String, String> defineValues = new HashMap<>();
5858
private static final Set<String> templateSearchPath = new HashSet<>();

src/main/java/org/entityc/compiler/cmdline/command/CLBuild.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,6 @@ public void run(String[] args) {
107107
EntityCompiler.RunConfiguration(configuration);
108108
ProjectManager.getInstance().endActiveConfiguration();
109109

110-
// If the configuration include a protoc block
111-
EntityCompiler.RunProtoc(root, configuration);
112-
113110
// close out our session
114111
ProjectManager.getInstance().close();
115112
if (!quietMode) {

src/main/java/org/entityc/compiler/cmdline/command/CLSchema.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,11 @@ public void run(String[] args) {
9696
}
9797
for (String schemaDirectory : directories) {
9898
SSSchemaVersioning.setBasePath(schemaDirectory);
99-
int readVersion = LoadSchemaVersion(SSSchemaVersioning.SchemaPointer.Read);
99+
Integer readVersion = LoadSchemaVersion(SSSchemaVersioning.SchemaPointer.Read);
100100
ECLog.log("");
101101
ECLog.log("Schema Directory: " + schemaDirectory);
102-
ECLog.log(" Previous version: " + ((readVersion > 1) ?
103-
readVersion :
102+
ECLog.log(" Previous version: " + ((readVersion > 0) ?
103+
("" + readVersion) :
104104
"(none)"));
105105
ECLog.log(" Current version: " + LoadSchemaVersion(SSSchemaVersioning.SchemaPointer.Write));
106106
ECLog.log(" Version advance directive: " + (SSSchemaVersioning.LoadAdvanceRequest() ?

src/main/java/org/entityc/compiler/repository/LocalRepositoryImporter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public RepositoryFile importFromRepository(MTRepository repository, MTRepository
3939
try {
4040
FileInputStream fis = new FileInputStream(inputFilepath);
4141

42-
ECLog.logInfo("Copying file " + inputFilepath + " to " + outputFilepath);
42+
// ECLog.logInfo("Copying file " + inputFilepath + " to " + outputFilepath);
4343
File outputFile = new File(outputFilepath);
4444
FileOutputStream fos = new FileOutputStream(outputFile);
4545
IOUtils.copy(fis, fos);

src/main/java/org/entityc/compiler/structure/sql/SSSchemaVersioning.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
package org.entityc.compiler.structure.sql;
88

99
import com.google.gson.Gson;
10+
import com.google.gson.GsonBuilder;
1011
import com.google.gson.stream.JsonReader;
1112
import com.google.gson.stream.JsonWriter;
1213
import org.entityc.compiler.EntityCompiler;
@@ -31,7 +32,9 @@ public static void SaveSchemaVersion(SchemaPointer pointer, Integer version) {
3132
"readVersion" :
3233
"writeVersion";
3334
String filepath = basePath + File.separator + pointerFilename + ".json";
34-
Gson gson = new Gson();
35+
Gson gson = new GsonBuilder()
36+
.excludeFieldsWithoutExposeAnnotation()
37+
.create();
3538
try {
3639
ensureBasePathDirectoryExists();
3740
FileOutputStream fos = new FileOutputStream(filepath);

src/main/java/org/entityc/compiler/structure/sql/SSSourceFile.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
package org.entityc.compiler.structure.sql;
88

99
import com.google.gson.annotations.Expose;
10-
import org.entityc.compiler.EntityCompiler;
1110
import org.entityc.compiler.util.ECLog;
1211

1312
import java.io.Serializable;
@@ -32,6 +31,7 @@ public class SSSourceFile extends SSNode implements Serializable {
3231
@Expose
3332
private final List<SSTable> tablesInOrder = new ArrayList<>();
3433

34+
@Expose
3535
private final Map<String, SSIndex> indexesByName = new HashMap<>();
3636

3737
@Expose
@@ -50,13 +50,9 @@ public List<SSTable> getTablesInOrder() {
5050
}
5151

5252
public void addTable(SSTable table) {
53-
if (table.getName().endsWith("_many")) {
54-
if (EntityCompiler.isVerbose()) {
55-
ECLog.logInfo("ADDING TABLE: " + table.getName());
56-
}
57-
if (tablesByName.containsKey(table.getName())) {
58-
//ECLog.logFatal("HEY! You can't add the same table multiple times!");
59-
}
53+
if (tablesByName.containsKey(table.getName())) {
54+
ECLog.logWarning("Tried to add table multiple times: " + table.getName());
55+
return;
6056
}
6157
tablesByName.put(table.getName(), table);
6258
tablesByEntityName.put(table.getEntityName(), table);
@@ -107,6 +103,7 @@ public Collection<SSIndex> getIndexes() {
107103
public Collection<SSSequence> getSequences() {
108104
return sequences;
109105
}
106+
110107
public String getFilename() {
111108
return getName() + "." + getExtension();
112109
}
@@ -207,7 +204,6 @@ public void processDependencyIssues() {
207204
}
208205
}
209206
for (SSAlteredTable alteredTable : newAlteredTables) {
210-
this.addTable(alteredTable);
211207
tablesInOrder.add(alteredTable);
212208
}
213209
}

src/main/java/org/entityc/compiler/structure/sql/SSTable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class SSTable extends SSNode {
2323
private SSComment comment;
2424

2525
public SSTable(String tableName, String entityName) {
26-
this.name = tableName;
26+
this.name = tableName;
2727
this.entityName = entityName;
2828
}
2929

0 commit comments

Comments
 (0)