Skip to content

Commit

Permalink
Fix recovery table name of shred model (closes #189)
Browse files Browse the repository at this point in the history
  • Loading branch information
oguzhanunlu committed Jun 23, 2023
1 parent 5fe041c commit d8ce712
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ object ShredModel {
errors: NonEmptyList[Breaking]) extends ShredModel {
def errorAsStrings: NonEmptyList[String] = errors.map(_.report)

val tableName = s"${baseTableName}_${schemaKey.version.addition}_${schemaKey.version.revision}_recovered_${abs(entries.show.hashCode())}"
val tableName = s"${baseTableName}_${schemaKey.version.revision}_${schemaKey.version.addition}_recovered_${abs(entries.show.hashCode())}"
}

def good(s: IgluSchema): GoodModel = good(s.self.schemaKey, s.schema)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ class ShredModelSpec extends Specification {
}""".schema)

s1.merge(s2).toTestString must beLeft(
"""CREATE TABLE IF NOT EXISTS s.com_acme_example_1_1_0_recovered_194359593 (
"""CREATE TABLE IF NOT EXISTS s.com_acme_example_1_0_1_recovered_194359593 (
| "schema_vendor" VARCHAR(128) ENCODE ZSTD NOT NULL,
| "schema_name" VARCHAR(128) ENCODE ZSTD NOT NULL,
| "schema_format" VARCHAR(128) ENCODE ZSTD NOT NULL,
Expand All @@ -245,7 +245,7 @@ class ShredModelSpec extends Specification {
|DISTKEY (root_id)
|SORTKEY (root_tstamp);
|
|COMMENT ON TABLE s.com_acme_example_1_1_0_recovered_194359593 IS 'iglu:com.acme/example/jsonschema/1-0-1';
|COMMENT ON TABLE s.com_acme_example_1_0_1_recovered_194359593 IS 'iglu:com.acme/example/jsonschema/1-0-1';
|
|Incompatible types in column foo old RedshiftVarchar(20) new RedshiftDouble""".stripMargin
)
Expand All @@ -272,7 +272,7 @@ class ShredModelSpec extends Specification {
}""".schema)

s1.merge(s2).toTestString must beLeft(
"""CREATE TABLE IF NOT EXISTS s.com_acme_example_1_1_0_recovered_1202144068 (
"""CREATE TABLE IF NOT EXISTS s.com_acme_example_1_0_1_recovered_1202144068 (
| "schema_vendor" VARCHAR(128) ENCODE ZSTD NOT NULL,
| "schema_name" VARCHAR(128) ENCODE ZSTD NOT NULL,
| "schema_format" VARCHAR(128) ENCODE ZSTD NOT NULL,
Expand All @@ -289,7 +289,7 @@ class ShredModelSpec extends Specification {
|DISTKEY (root_id)
|SORTKEY (root_tstamp);
|
|COMMENT ON TABLE s.com_acme_example_1_1_0_recovered_1202144068 IS 'iglu:com.acme/example/jsonschema/1-0-1';
|COMMENT ON TABLE s.com_acme_example_1_0_1_recovered_1202144068 IS 'iglu:com.acme/example/jsonschema/1-0-1';
|
|Making required column nullable foo""".stripMargin
)
Expand Down Expand Up @@ -593,7 +593,7 @@ class ShredModelSpec extends Specification {

foldMapRedshiftSchemas(NonEmptyList.of(s1, s2, s3))(dummyKey1).asInstanceOf[RecoveryModel]
.asLeft[GoodModel].toTestString must beLeft(
"""CREATE TABLE IF NOT EXISTS s.com_acme_example_1_1_0_recovered_194359593 (
"""CREATE TABLE IF NOT EXISTS s.com_acme_example_1_0_1_recovered_194359593 (
| "schema_vendor" VARCHAR(128) ENCODE ZSTD NOT NULL,
| "schema_name" VARCHAR(128) ENCODE ZSTD NOT NULL,
| "schema_format" VARCHAR(128) ENCODE ZSTD NOT NULL,
Expand All @@ -610,7 +610,7 @@ class ShredModelSpec extends Specification {
|DISTKEY (root_id)
|SORTKEY (root_tstamp);
|
|COMMENT ON TABLE s.com_acme_example_1_1_0_recovered_194359593 IS 'iglu:com.acme/example/jsonschema/1-0-1';
|COMMENT ON TABLE s.com_acme_example_1_0_1_recovered_194359593 IS 'iglu:com.acme/example/jsonschema/1-0-1';
|
|Incompatible types in column foo old RedshiftVarchar(20) new RedshiftDouble""".stripMargin
)
Expand Down

0 comments on commit d8ce712

Please sign in to comment.