-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify the
User
database model by dropping unused columns
The following columns are dropped: * `password` * `date_joined` * `groups` * `is_active` * `is_staff` * `is_superuser` * `last_login` * `user_permissions` These columns were originally added because the base user class of the Django framework was used, which provided the ORM layer. However, these attributes are not used at all and Django does not require them in order to work properly. Therefore, we remove them from the models for both backends. Note that in principle, the `contrib` and `auth` applications currently installed for Django, could also be removed without affecting the functionality of `aiida-core` since it no longer requires the built in authentication application of Django. However, since the initial migration schema still references it, we cannot yet remove it fully. If we were to reset the database migration schema, we could get rid of these unnecessary dependencies.
- Loading branch information
Showing
24 changed files
with
200 additions
and
373 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
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
68 changes: 68 additions & 0 deletions
68
aiida/backends/djsite/db/migrations/0035_simplify_user_model.py
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# -*- coding: utf-8 -*- | ||
########################################################################### | ||
# Copyright (c), The AiiDA team. All rights reserved. # | ||
# This file is part of the AiiDA code. # | ||
# # | ||
# The code is hosted on GitHub at https://github.com/aiidateam/aiida_core # | ||
# For further information on the license, see the LICENSE.txt file # | ||
# For further information please visit http://www.aiida.net # | ||
########################################################################### | ||
# pylint: disable=invalid-name,too-few-public-methods | ||
"""Simplify the `DbUser` model.""" | ||
from __future__ import division | ||
from __future__ import print_function | ||
from __future__ import unicode_literals | ||
from __future__ import absolute_import | ||
|
||
# Remove when https://github.com/PyCQA/pylint/issues/1931 is fixed | ||
# pylint: disable=no-name-in-module,import-error,no-member | ||
from django.db import migrations | ||
|
||
from aiida.backends.djsite.db.migrations import upgrade_schema_version | ||
|
||
REVISION = '1.0.35' | ||
DOWN_REVISION = '1.0.34' | ||
|
||
|
||
class Migration(migrations.Migration): | ||
"""Simplify the `DbUser` model by dropping unused columns.""" | ||
|
||
dependencies = [ | ||
('db', '0034_drop_node_columns_nodeversion_public'), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name='dbuser', | ||
name='password', | ||
), | ||
migrations.RemoveField( | ||
model_name='dbuser', | ||
name='date_joined', | ||
), | ||
migrations.RemoveField( | ||
model_name='dbuser', | ||
name='groups', | ||
), | ||
migrations.RemoveField( | ||
model_name='dbuser', | ||
name='is_active', | ||
), | ||
migrations.RemoveField( | ||
model_name='dbuser', | ||
name='is_staff', | ||
), | ||
migrations.RemoveField( | ||
model_name='dbuser', | ||
name='is_superuser', | ||
), | ||
migrations.RemoveField( | ||
model_name='dbuser', | ||
name='last_login', | ||
), | ||
migrations.RemoveField( | ||
model_name='dbuser', | ||
name='user_permissions', | ||
), | ||
upgrade_schema_version(REVISION, DOWN_REVISION) | ||
] |
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
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
Oops, something went wrong.