Skip to content

fix: Support SQLite in migration 0079_apitoken_data#2111

Open
OmAnand857 wants to merge 1 commit intoaboutcode-org:mainfrom
OmAnand857:fix/0079_apitoken_data.py
Open

fix: Support SQLite in migration 0079_apitoken_data#2111
OmAnand857 wants to merge 1 commit intoaboutcode-org:mainfrom
OmAnand857:fix/0079_apitoken_data.py

Conversation

@OmAnand857
Copy link

Issues

  • Closes: N/A

Changes

  • Fixed a migration failure when using SQLite caused by a PostgreSQL-specific query.
  • Added a conditional check for the database backend and used the appropriate query for each.
  • Ensured that migrations run correctly for both PostgreSQL and SQLite setups.

The migration file 0079_apitoken_data.py was written with PostgreSQL-specific SQL syntax:

cursor.execute(
    "SELECT EXISTS (SELECT 1 FROM information_schema.tables "
    "WHERE table_name = 'authtoken_token')"
)

SQLite uses a completely different system table called sqlite_master

Changed code Detects which database is being used and apply the correct syntax for each

Checklist

  • I have read the contributing guidelines
  • I have linked an existing issue above
  • I have added unit tests covering the new code
  • I have reviewed and understood every line of this PR

Signed-off-by: OmAnand857 <allansmith2561@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant