Skip to content

Snippets

Andrei edited this page Feb 3, 2025 · 2 revisions

Summary

In this page you can find common commits that can be changed and applied to help with common coding tasking.

Use git reset HEAD if you need to discard all the changes

If you want to manually edit instead of | git apply --3 -C1 do > out.diff then edit out.diff and git apply --3 -C1 < out.diff

Make sure to apply diff from root dir.

Sometimes git apply will fail, can try with --reject flag (instead of --3way)

Commit snippets

New version and migration

From this commit

NEW_VERSION=2_07_00
NEW_VERSION_DOT=2.7.0
PREVIOUS_VERSION=2_06_00
MIGRATION=new_migration_name
git show 1df4fcac3e09ccc428e1740fc44b7b815bfda429 | sed 's/2_06_00/'${NEW_VERSION}'/g ; s/2.6.0/'${NEW_VERSION_DOT}'/g ; s/2_05_00/'${PREVIOUS_VERSION}'/g ; s/add_index_to_sync_buffer/'${MIGRATION}'/g' | git apply --3 -C1 --whitespace=fix
New table with sync (as omSupply central data)

From this commit

NEW_TABLE_NAME=new_table
NEW_TABLE_NAME_CAMEL=NewTable
MIGRATION=2_06_00
MIGRATION_NAME=add_new_table

git show acc8bce66e49cd0f91f9351e3be02ba188664dd4 | sed 's/ExampleTable/'${NEW_TABLE_NAME_CAMEL}'/g ; s/example_table/'${NEW_TABLE_NAME}'/g ; s/2_06_00/'${MIGRATION}'/g ; s/add_example_table/'${MIGRATION_NAME}'/g' | git apply --3 -C1 --whitespace=fix
New Key Type for KeyValueStore

Part of this commit

NEW_VARIANT=LoadPluginProcessorCursor
NEW_VARIANT_PG=LOAD_PLUGIN_PROCESSOR_CURSOR
MIGRATION=2_06_00
MIGRATION_NAME=add_some_variant

git show acc8bce66e49cd0f91f9351e3be02ba188664dd4 | sed 's/LoadPluginProcessorCursor/'${NEW_VARIANT}'/g ; s/LOAD_PLUGIN_PROCESSOR_CURSOR/'${LOAD_PLUGIN_PROCESSOR_CURSOR}'/g ; s/2_06_00/'${MIGRATION}'/g ; s/add_load_plugin_processor_pg_enum_type/'${MIGRATION_NAME}'/g' | git apply --3 -C1 --whitespace=fix