Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

table.disable_fts() method and "sqlite-utils disable-fts ..." command #88

Closed
simonw opened this issue Feb 27, 2020 · 5 comments
Closed
Labels
enhancement New feature or request

Comments

@simonw
Copy link
Owner

simonw commented Feb 27, 2020

This would make it easier to iterate on the FTS configuration for a database without having to wipe and recreate the database each time.

@simonw simonw added the enhancement New feature or request label Feb 27, 2020
@simonw
Copy link
Owner Author

simonw commented Feb 27, 2020

drop table resources_fts drops the FTS table and the other ones that it created (resources_fts_data, resources_fts_idx, resources_fts_docsize, resources_fts_config) - but keeps the triggers.

@simonw
Copy link
Owner Author

simonw commented Feb 27, 2020

I can reliably get the list of triggers to delete from select name from sqlite_master where type = 'trigger' and tbl_name = 'resources';

@simonw
Copy link
Owner Author

simonw commented Feb 27, 2020

Strange - https://www.sqlite.org/lang_droptrigger.html says "Note that triggers are automatically dropped when the associated table is dropped" but that doesn't seem to be true in my experimenting.

UPDATE: no that makes sense - the triggers are on resources which still exists, it was resources_fts that was dropped.

@simonw
Copy link
Owner Author

simonw commented Feb 27, 2020

Looks like safest option is to loop through those trigger names and run DROP TRIGGER IF EXISTS foo on each one.

@simonw
Copy link
Owner Author

simonw commented Feb 27, 2020

I think the method should be called table.disable_fts() - the opposite of table.enable_fts(...).

There should be a sqlite-utils disable-fts database.db tablename command to match it.

@simonw simonw changed the title Methods for deleting FTS tables and triggers for a specific content table table.disable_fts() method and "sqlite-utils disable-fts ..." command Feb 27, 2020
@simonw simonw closed this as completed in f9473ac Feb 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant