MCPcopy Index your code
hub / github.com/unclecode/crawl4ai / update_db_schema

Method update_db_schema

crawl4ai/async_database.py:34–47  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

32 await self.update_db_schema()
33
34 async def update_db_schema(self):
35 async with aiosqlite.connect(self.db_path) as db:
36 # Check if the 'media' column exists
37 cursor = await db.execute("PRAGMA table_info(crawled_data)")
38 columns = await cursor.fetchall()
39 column_names = [column[1] for column in columns]
40
41 if 'media' not in column_names:
42 await self.aalter_db_add_column('media')
43
44 # Check for other missing columns and add them if necessary
45 for column in ['links', 'metadata', 'screenshot']:
46 if column not in column_names:
47 await self.aalter_db_add_column(column)
48
49 async def aalter_db_add_column(self, new_column: str):
50 try:

Callers 1

ainit_dbMethod · 0.95

Calls 1

aalter_db_add_columnMethod · 0.95

Tested by

no test coverage detected