`.transform()` effect on triggers and indices
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.2k
- Forks
- 172
- Avg merge
- 9m
- Merged PRs (30d)
- 1
Description
Could you clarify and expand what the upgrade verb in the following statement from Custom transformations with .transform_sql means, please?
The .transform() method can handle most cases, but it does not automatically upgrade indexes, views or triggers associated with the table that is being transformed.
I make heavy use of triggers and consider using sqlite-utils for migrations, so understanding exactly what happens to my triggers is kind of important. Are we talking about cases where, say I rename a column which a trigger relied upon? E.g. in the following example:
CREATE TRIGGER IF NOT EXISTS insert_lang_on_thread_subject AFTER UPDATE OF subject ON thread
WHEN NEW.subject IN (6, 7)
BEGIN
...
END
any changes to the thread table, like, say renaming subject field won't be reflected in this trigger? Is this what the won't upgrade above mean?
IIUC the proposed remedy is to grab the sql code for changes from .transfor_sql() and for this particular example, I guess, add a statement that drops the trigger and creates a new one with correct references to tables and columns?
Thank you
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the “Custom transformations with .transform_sql” section in the linked Python API documentation and review how .transform() handles indexes, views, and triggers. Clarify what “upgrade” means, including the trigger example in the issue, and make the documented behavior and recommended migration steps explicit.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, sqlite
- Domain
- databases, documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100