Hide FTS tables that have content=

* Hide FTS tables that have content=, closes #2477
This commit is contained in:
Simon Willison 2025-04-16 21:44:09 -07:00 committed by GitHub
commit f2485dce9c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 67 additions and 26 deletions

View file

@ -389,29 +389,6 @@ async def test_database_page(ds_client):
},
"private": False,
},
{
"name": "searchable_fts",
"columns": [
"text1",
"text2",
"name with . and spaces",
]
+ (
[
"searchable_fts",
"docid",
"__langid",
]
if supports_table_xinfo()
else []
),
"primary_keys": [],
"count": 2,
"hidden": False,
"fts_table": "searchable_fts",
"foreign_keys": {"incoming": [], "outgoing": []},
"private": False,
},
{
"name": "searchable_tags",
"columns": ["searchable_id", "tag"],
@ -538,6 +515,31 @@ async def test_database_page(ds_client):
"foreign_keys": {"incoming": [], "outgoing": []},
"private": False,
},
{
"columns": Either(
[
"text1",
"text2",
"name with . and spaces",
"searchable_fts",
"docid",
"__langid",
],
# Get tests to pass on SQLite 3.25 as well
[
"text1",
"text2",
"name with . and spaces",
],
),
"count": 2,
"foreign_keys": {"incoming": [], "outgoing": []},
"fts_table": "searchable_fts",
"hidden": True,
"name": "searchable_fts",
"primary_keys": [],
"private": False,
},
{
"name": "searchable_fts_docsize",
"columns": ["docid", "size"],
@ -1198,3 +1200,12 @@ async def test_upgrade_metadata(metadata, expected_config, expected_metadata):
assert response.json() == expected_config
response2 = await ds.client.get("/-/metadata.json")
assert response2.json() == expected_metadata
class Either:
def __init__(self, a, b):
self.a = a
self.b = b
def __eq__(self, other):
return other == self.a or other == self.b