mirror of
https://github.com/hanzoai/tasks.git
synced 2026-10-04 02:04:03 +00:00
<!-- Describe what has changed in this PR --> **What changed?** I renamed all of our Go source code files so that they're snake case instead of camel case. <!-- Tell your future self why have you made these changes --> **Why?** This was an annoying inconsistency we carried over from much older code in the repo. <!-- How have you verified this change? Tested locally? Added a unit test? Checked in staging env? --> **How did you test it?** The renaming process was part of an automated script (https://gist.github.com/MichaelSnowden/47576fffe27aa1cae6b26eaccec7ab55), so it should be consistent. Also, I don't see us doing anything in our codebase that involves parsing our own source files by path: <img width="687" alt="image" src="https://github.com/temporalio/temporal/assets/5942963/c6b873b0-d841-40d1-8b0f-2fe9d8079a53"> *PS: here's a link to the GPT convo I had to generate this renaming script: https://chat.openai.com/share/7f2d011a-a8da-4fa4-9c6d-e09102fdd49f* <!-- Assuming the worst case, what can be broken when deploying this change to production? --> **Potential risks** Mainly merge conflicts, but I used `git mv` so that these are renames instead of deletes/adds, so that shouldn't be a big issue. <!-- Is this PR a hotfix candidate or require that a notification be sent to the broader community? (Yes/No) --> **Is hotfix candidate?** No.
Using the SQL schema tool
This package contains the tooling for temporal sql operations. The tooling itself is agnostic of the storage engine behind the sql interface. So, this same tool can be used against, say, OracleDB and MySQLDB
For localhost development
SQL_USER=$USERNAME SQL_PASSWORD=$PASSWD make install-schema-mysql
For production
Create the binary
- Run
make temporal-sql-toolon the root of repositroy - You should see an executable
temporal-sql-tool - Temporal officially support MySQL and Postgres for SQL.
- For other SQL database, you can add it easily as we do for MySQL/Postgres following our code in sql-extensions
Do one time database creation and schema setup for a new cluster
- All command below are taking MySQL as example. For postgres, simply use with "--plugin postgres"
./temporal-sql-tool --ep $SQL_HOST -p $port --db temporal --plugin mysql create
./temporal-sql-tool --ep $SQL_HOST -p $port --db temporal_visibility --plugin mysql create
./temporal-sql-tool --ep $SQL_HOST -p $port --plugin mysql --db temporal setup-schema -v 0.0 -- this sets up just the schema version tables with initial version of 0.0
./temporal-sql-tool --ep $SQL_HOST -p $port --plugin mysql --db temporal update-schema -d ./schema/mysql/v57/temporal/versioned -- upgrades your schema to the latest version
./temporal-sql-tool --ep $SQL_HOST -p $port --plugin mysql --db temporal_visibility setup-schema -v 0.0 -- this sets up just the schema version tables with initial version of 0.0 for visibility
./temporal-sql-tool --ep $SQL_HOST -p $port --plugin mysql --db temporal_visibility update-schema -d ./schema/mysql/v57/visibility/versioned -- upgrades your schema to the latest version for visibility
Update schema as part of a release
You can only upgrade to a new version after the initial setup done above.
./temporal-sql-tool --ep $SQL_HOST -p $port --plugin mysql --db temporal update-schema -d ./schema/mysql/v57/temporal/versioned -v x.x -- executes the upgrade to version x.x
./temporal-sql-tool --ep $SQL_HOST -p $port --plugin mysql --db temporal_visibility update-schema -d ./schema/mysql/v57/visibility/versioned -v x.x -- executes the upgrade to version x.x