(self)
| 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: |
no test coverage detected