Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
4 changed files
with
51 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,48 @@ | ||
# Generated by Django 2.2.17 on 2022-02-25 15:10 | ||
|
||
from django.db import connections, migrations | ||
|
||
|
||
def create_user_files_index(apps, schema_editor): | ||
# Create an index on file_path column | ||
# Note: on MySQL/MariaDB, create the index on the first 255 characters of file_path | ||
if connections.databases[schema_editor.connection.alias]['ENGINE'] == 'django.db.backends.mysql': | ||
in_atomic_block = schema_editor.connection.in_atomic_block | ||
schema_editor.connection.in_atomic_block = False | ||
try: | ||
schema_editor.execute(''' | ||
create index index_airavata_django_portal_sdk_userfiles_file_path on airavata_django_portal_sdk_userfiles (file_path(255)); | ||
''') | ||
finally: | ||
schema_editor.connection.in_atomic_block = in_atomic_block | ||
else: | ||
schema_editor.execute(''' | ||
create index index_airavata_django_portal_sdk_userfiles_file_path on airavata_django_portal_sdk_userfiles (file_path); | ||
''') | ||
|
||
|
||
def drop_user_files_index(apps, schema_editor): | ||
if connections.databases[schema_editor.connection.alias]['ENGINE'] == 'django.db.backends.mysql': | ||
in_atomic_block = schema_editor.connection.in_atomic_block | ||
schema_editor.connection.in_atomic_block = False | ||
try: | ||
schema_editor.execute(''' | ||
drop index index_airavata_django_portal_sdk_userfiles_file_path on airavata_django_portal_sdk_userfiles; | ||
''') | ||
finally: | ||
schema_editor.connection.in_atomic_block = in_atomic_block | ||
else: | ||
schema_editor.execute(''' | ||
drop index index_airavata_django_portal_sdk_userfiles_file_path on airavata_django_portal_sdk_userfiles; | ||
''') | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('airavata_django_portal_sdk', '0002_userfiles_file_resource_id'), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(create_user_files_index, drop_user_files_index) | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -2,7 +2,7 @@ airavata-python-sdk==1.0.1 | ||
bcrypt==3.1.7 | ||
cffi==1.14.1 | ||
cryptography==3.0 | ||
Django==2.2.17 | ||
Django==3.2.12 | ||
djangorestframework==3.10.3 | ||
google-api-python-client==1.12.8 | ||
grpcio-tools==1.34.1 | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters