Skip to content

Initialize test schema versions#10790

Open
stephanos wants to merge 14 commits into
mainfrom
stephanos/server-startup-hosts-custom-persistence
Open

Initialize test schema versions#10790
stephanos wants to merge 14 commits into
mainfrom
stephanos/server-startup-hosts-custom-persistence

Conversation

@stephanos

@stephanos stephanos commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Initialize schema-version metadata for SQL & Cassandra test databases.

Why

We're moving away from the onebox fx graph to use the production graph in temporal.NewServerFx; and it needs the schema version metadata to be present or it fails to start.

@stephanos stephanos changed the title Relax startup checks for custom server options Align startup checks for onebox support Jun 21, 2026
@stephanos stephanos changed the title Align startup checks for onebox support Align test persistence with startup checks Jun 22, 2026
@stephanos stephanos changed the title Align test persistence with startup checks Initialize test schema versions Jun 22, 2026
}
}()
err = db.CreateDatabase(s.cfg.DatabaseName)
db := s.newAdminDB(sqlplugin.DbKindUnknown, &cfg2)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new helper

}
s.LoadSchema(path.Join(schemaDir, "temporal", "schema.sql"))
s.LoadSchema(path.Join(schemaDir, "visibility", "schema.sql"))
s.LoadSchemaVersion()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the main change 2/2

Comment thread common/persistence/cassandra/test.go Outdated
}

s.LoadSchema(path.Join(schemaDir, "temporal", "schema.cql"))
s.LoadSchemaVersion()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the main change 1/2

writeSchemaVersionCQL = `INSERT into schema_version(keyspace_name, creation_time, curr_version, min_compatible_version) VALUES (?,?,?,?)`

writeSchemaUpdateHistoryCQL = `INSERT into schema_update_history(year, month, update_time, old_version, new_version, manifest_md5, description) VALUES(?,?,?,?,?,?,?)`
)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ these are defined in temporal/tools/cassandra/cqlclient.go but there's no precedence for re-use there so we copy them here; the SQL variants do the same

@stephanos stephanos marked this pull request as ready for review June 22, 2026 15:20
@stephanos stephanos requested review from a team as code owners June 22, 2026 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant