Browse Source

refs: Remove sqlite references from code

We no longer support sqlite, so remove references from the codebase
Dan Fuller 6 years ago
parent
commit
234449f723

+ 0 - 1
.gitignore

@@ -23,7 +23,6 @@ sentry-package.json
 /tmp
 /node_modules/
 /docs-ui/node_modules/
-example/db.sqlite
 /src/sentry/assets.json
 /src/sentry/static/version
 /src/sentry/static/sentry/dist/

+ 2 - 4
Makefile

@@ -216,9 +216,8 @@ travis-noop:
 .PHONY: travis-test-lint
 travis-test-lint: lint-python lint-js
 
-.PHONY: travis-test-postgres travis-test-mysql travis-test-acceptance travis-test-snuba travis-test-symbolicator travis-test-js travis-test-cli travis-test-dist travis-test-riak
+.PHONY: travis-test-postgres travis-test-acceptance travis-test-snuba travis-test-symbolicator travis-test-js travis-test-cli travis-test-dist travis-test-riak
 travis-test-postgres: test-python
-travis-test-mysql: test-python
 travis-test-acceptance: test-acceptance
 travis-test-snuba: test-snuba
 travis-test-symbolicator: test-symbolicator
@@ -233,7 +232,7 @@ travis-test-dist:
 	@ls -lh dist/
 travis-test-riak: test-riak
 
-.PHONY: scan-python travis-scan-postgres travis-scan-mysql travis-scan-acceptance travis-scan-snuba travis-scan-symbolicator travis-scan-js travis-scan-cli travis-scan-dist travis-scan-lint travis-scan-riak
+.PHONY: scan-python travis-scan-postgres travis-scan-acceptance travis-scan-snuba travis-scan-symbolicator travis-scan-js travis-scan-cli travis-scan-dist travis-scan-lint travis-scan-riak
 scan-python:
 	@echo "--> Running Python vulnerability scanner"
 	$(PIP) install safety
@@ -241,7 +240,6 @@ scan-python:
 	@echo ""
 
 travis-scan-postgres: scan-python
-travis-scan-mysql: scan-python
 travis-scan-acceptance: travis-noop
 travis-scan-snuba: scan-python
 travis-scan-symbolicator: travis-noop

+ 0 - 7
src/bitfield/types.py

@@ -265,13 +265,6 @@ if django.VERSION[:2] >= (1, 8):
 
     # We need to register adapters in Django 1.8 in order to prevent
     # "ProgrammingError: can't adapt type"
-    try:
-        from django.db.backends.sqlite3.base import Database
-        Database.register_adapter(Bit, lambda x: int(x))
-        Database.register_adapter(BitHandler, lambda x: int(x))
-    except ImproperlyConfigured:
-        pass
-
     try:
         from django.db.backends.postgresql_psycopg2.base import Database
         Database.extensions.register_adapter(Bit, lambda x: Database.extensions.AsIs(int(x)))

+ 1 - 6
src/debug_toolbar/panels/sql/views.py

@@ -43,12 +43,7 @@ def sql_explain(request):
         vendor = form.connection.vendor
         cursor = form.cursor
 
-        if vendor == 'sqlite':
-            # SQLite's EXPLAIN dumps the low-level opcodes generated for a query;
-            # EXPLAIN QUERY PLAN dumps a more human-readable summary
-            # See http://www.sqlite.org/lang_explain.html for details
-            cursor.execute("EXPLAIN QUERY PLAN %s" % (sql, ), params)
-        elif vendor == 'postgresql':
+        if vendor == 'postgresql':
             cursor.execute("EXPLAIN ANALYZE %s" % (sql, ), params)
         else:
             cursor.execute("EXPLAIN %s" % (sql, ), params)

+ 1 - 6
src/sentry/api/endpoints/team_groups_new.py

@@ -8,7 +8,6 @@ from sentry.api.base import EnvironmentMixin
 from sentry.api.bases.team import TeamEndpoint
 from sentry.api.serializers import serialize, GroupSerializer
 from sentry.models import Group, GroupStatus, Project
-from sentry.utils.db import get_db_engine
 
 
 class TeamGroupsNewEndpoint(TeamEndpoint, EnvironmentMixin):
@@ -30,11 +29,7 @@ class TeamGroupsNewEndpoint(TeamEndpoint, EnvironmentMixin):
         cutoff = timedelta(minutes=minutes)
         cutoff_dt = timezone.now() - cutoff
 
-        if get_db_engine('default') == 'sqlite':
-            sort_value = 'times_seen'
-        else:
-            sort_value = 'score'
-
+        sort_value = 'score'
         group_list = list(
             Group.objects.filter(
                 project__in=project_dict.keys(),

+ 1 - 6
src/sentry/api/endpoints/team_groups_trending.py

@@ -8,7 +8,6 @@ from sentry.api.base import EnvironmentMixin
 from sentry.api.bases.team import TeamEndpoint
 from sentry.api.serializers import serialize, GroupSerializer
 from sentry.models import Group, GroupStatus, Project
-from sentry.utils.db import get_db_engine
 
 
 class TeamGroupsTrendingEndpoint(TeamEndpoint, EnvironmentMixin):
@@ -30,11 +29,7 @@ class TeamGroupsTrendingEndpoint(TeamEndpoint, EnvironmentMixin):
         cutoff = timedelta(minutes=minutes)
         cutoff_dt = timezone.now() - cutoff
 
-        if get_db_engine('default') == 'sqlite':
-            sort_value = 'times_seen'
-        else:
-            sort_value = 'score'
-
+        sort_value = 'score'
         group_list = list(
             Group.objects.filter(
                 project__in=project_dict.keys(),

+ 0 - 3
src/sentry/db/models/fields/bounded.py

@@ -73,9 +73,6 @@ if settings.SENTRY_USE_BIG_INTS:
             engine = connection.settings_dict['ENGINE']
             if 'postgres' in engine:
                 return "bigserial"
-            # SQLite doesnt actually support bigints with auto incr
-            elif 'sqlite' in engine:
-                return 'integer'
             else:
                 raise NotImplemented
 

+ 1 - 29
src/sentry/models/counter.py

@@ -12,7 +12,7 @@ from django.db import connection, connections
 from django.db.models.signals import post_syncdb
 
 from sentry.db.models import (FlexibleForeignKey, Model, sane_repr, BoundedBigIntegerField)
-from sentry.utils.db import is_postgres, is_sqlite
+from sentry.utils.db import is_postgres
 
 
 class Counter(Model):
@@ -47,34 +47,6 @@ def increment_project_counter(project, delta=1):
             ''', [project.id, delta]
             )
             return cur.fetchone()[0]
-        elif is_sqlite():
-            value = cur.execute(
-                '''
-                insert or ignore into sentry_projectcounter
-                  (project_id, value) values (%s, 0);
-            ''', [project.id]
-            )
-            value = cur.execute(
-                '''
-                select value from sentry_projectcounter
-                 where project_id = %s
-            ''', [project.id]
-            ).fetchone()[0]
-            while True:
-                cur.execute(
-                    '''
-                    update sentry_projectcounter
-                       set value = value + %s
-                     where project_id = %s;
-                ''', [delta, project.id]
-                )
-                changes = cur.execute(
-                    '''
-                    select changes();
-                '''
-                ).fetchone()[0]
-                if changes != 0:
-                    return value + delta
         else:
             raise AssertionError("Not implemented database engine path")
     finally:

+ 0 - 1
src/sentry/models/group.py

@@ -273,7 +273,6 @@ class Group(Model):
     active_at = models.DateTimeField(null=True, db_index=True)
     time_spent_total = BoundedIntegerField(default=0)
     time_spent_count = BoundedIntegerField(default=0)
-    # score will be incorrect in sqlite as it doesnt support the required functions
     score = BoundedIntegerField(default=0)
     # deprecated, do not use. GroupShare has superseded
     is_public = models.NullBooleanField(default=False, null=True)

+ 0 - 4
src/sentry/south_migrations/0135_auto__chg_field_project_team.py

@@ -44,10 +44,6 @@ class Migration(SchemaMigration):
         Project.objects.filter(team__isnull=True).update(team=team)
 
     def forwards(self, orm):
-        # this is shitty, but we dont care
-        if connection.vendor == 'sqlite':
-            transaction.set_autocommit(True)
-
         # ideally we would have done this data migration before this change, but
         # it was an oversight
         if not db.dry_run:

Some files were not shown because too many files changed in this diff