From f45bd4921dabd9d96f50a3f6e99dff3e39988ce6 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 9 Jul 2017 10:39:03 +0200 Subject: [PATCH] Re-add player-migrations, renamed to account-migrations --- evennia/accounts/migrations/0001_initial.py | 43 ++++++++--------- .../accounts/migrations/0002_move_defaults.py | 20 ++++++++ .../migrations/0003_auto_20150209_2234.py | 36 ++++++++++++++ .../migrations/0004_auto_20150403_2339.py | 48 +++++++++++++++++++ .../migrations/0005_auto_20160905_0902.py | 21 ++++++++ .../migrations/0006_auto_20170606_1731.py | 31 ++++++++++++ ...ount.py => 0007_copy_player_to_account.py} | 2 +- evennia/accounts/migrations/__init__.py | 1 + .../migrations/0013_auto_20170705_1726.py | 2 +- .../migrations/0007_objectdb_db_account.py | 2 +- .../migrations/0009_scriptdb_db_account.py | 2 +- 11 files changed, 180 insertions(+), 28 deletions(-) create mode 100644 evennia/accounts/migrations/0002_move_defaults.py create mode 100644 evennia/accounts/migrations/0003_auto_20150209_2234.py create mode 100644 evennia/accounts/migrations/0004_auto_20150403_2339.py create mode 100644 evennia/accounts/migrations/0005_auto_20160905_0902.py create mode 100644 evennia/accounts/migrations/0006_auto_20170606_1731.py rename evennia/accounts/migrations/{0002_copy_player_to_account.py => 0007_copy_player_to_account.py} (97%) diff --git a/evennia/accounts/migrations/0001_initial.py b/evennia/accounts/migrations/0001_initial.py index 85e2303490..d8d267f20c 100644 --- a/evennia/accounts/migrations/0001_initial.py +++ b/evennia/accounts/migrations/0001_initial.py @@ -1,54 +1,49 @@ # -*- coding: utf-8 -*- -# Generated by Django 1.11.2 on 2017-07-03 19:13 from __future__ import unicode_literals -import django.contrib.auth.validators -from django.db import migrations, models +from django.db import models, migrations import django.utils.timezone -import evennia.accounts.manager +import django.core.validators class Migration(migrations.Migration): - initial = True - dependencies = [ - ('auth', '0008_alter_user_username_max_length'), - ('typeclasses', '0008_lock_and_perm_rename'), + ('auth', '0001_initial'), + ('typeclasses', '0001_initial'), ] operations = [ migrations.CreateModel( name='AccountDB', fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('password', models.CharField(max_length=128, verbose_name='password')), - ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')), + ('last_login', models.DateTimeField(default=django.utils.timezone.now, verbose_name='last login')), ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')), - ('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.ASCIIUsernameValidator()], verbose_name='username')), - ('first_name', models.CharField(blank=True, max_length=30, verbose_name='first name')), - ('last_name', models.CharField(blank=True, max_length=30, verbose_name='last name')), - ('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')), + ('username', models.CharField(help_text='Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.', unique=True, max_length=30, verbose_name='username', validators=[django.core.validators.RegexValidator('^[\\w.@+-]+$', 'Enter a valid username.', 'invalid')])), + ('first_name', models.CharField(max_length=30, verbose_name='first name', blank=True)), + ('last_name', models.CharField(max_length=30, verbose_name='last name', blank=True)), + ('email', models.EmailField(max_length=75, verbose_name='email address', blank=True)), ('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')), ('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')), ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')), - ('db_key', models.CharField(db_index=True, max_length=255, verbose_name=b'key')), + ('db_key', models.CharField(max_length=255, verbose_name=b'key', db_index=True)), ('db_typeclass_path', models.CharField(help_text=b"this defines what 'type' of entity this is. This variable holds a Python path to a module with a valid Evennia Typeclass.", max_length=255, null=True, verbose_name=b'typeclass')), ('db_date_created', models.DateTimeField(auto_now_add=True, verbose_name=b'creation date')), - ('db_lock_storage', models.TextField(blank=True, help_text=b"locks limit access to an entity. A lock is defined as a 'lock string' on the form 'type:lockfunctions', defining what functionality is locked and how to determine access. Not defining a lock means no access is granted.", verbose_name=b'locks')), - ('db_is_connected', models.BooleanField(default=False, help_text=b'If player is connected to game or not', verbose_name=b'is_connected')), + ('db_lock_storage', models.TextField(help_text=b"locks limit access to an entity. A lock is defined as a 'lock string' on the form 'type:lockfunctions', defining what functionality is locked and how to determine access. Not defining a lock means no access is granted.", verbose_name=b'locks', blank=True)), + ('db_is_connected', models.BooleanField(default=False, help_text=b'If account is connected to game or not', verbose_name=b'is_connected')), ('db_cmdset_storage', models.CharField(help_text=b'optional python path to a cmdset class. If creating a Character, this will default to settings.CMDSET_CHARACTER.', max_length=255, null=True, verbose_name=b'cmdset')), ('db_is_bot', models.BooleanField(default=False, help_text=b'Used to identify irc/rss bots', verbose_name=b'is_bot')), - ('db_attributes', models.ManyToManyField(help_text=b'attributes on this object. An attribute can hold any pickle-able python object (see docs for special cases).', to='typeclasses.Attribute')), - ('db_tags', models.ManyToManyField(help_text=b'tags on this object. Tags are simple string markers to identify, group and alias objects.', to='typeclasses.Tag')), - ('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')), - ('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')), + ('db_attributes', models.ManyToManyField(help_text=b'attributes on this object. An attribute can hold any pickle-able python object (see docs for special cases).', to='typeclasses.Attribute', null=True)), + ('db_tags', models.ManyToManyField(help_text=b'tags on this object. Tags are simple string markers to identify, group and alias objects.', to='typeclasses.Tag', null=True)), + ('groups', models.ManyToManyField(related_query_name='user', related_name='user_set', to='auth.Group', blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of his/her group.', verbose_name='groups')), + ('user_permissions', models.ManyToManyField(related_query_name='user', related_name='user_set', to='auth.Permission', blank=True, help_text='Specific permissions for this user.', verbose_name='user permissions')), ], options={ 'verbose_name': 'Account', + 'verbose_name_plural': 'Accounts', }, - managers=[ - ('objects', evennia.accounts.manager.AccountDBManager()), - ], + bases=(models.Model,), ), ] diff --git a/evennia/accounts/migrations/0002_move_defaults.py b/evennia/accounts/migrations/0002_move_defaults.py new file mode 100644 index 0000000000..9fc8f0d4c4 --- /dev/null +++ b/evennia/accounts/migrations/0002_move_defaults.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + +def convert_defaults(apps, schema_editor): + AccountDB = apps.get_model("accounts", "AccountDB") + for account in AccountDB.objects.filter(db_typeclass_path="src.accounts.account.Account"): + account.db_typeclass_path = "typeclasses.accounts.Account" + account.save() + +class Migration(migrations.Migration): + + dependencies = [ + ('accounts', '0001_initial'), + ] + + operations = [ + migrations.RunPython(convert_defaults), + ] diff --git a/evennia/accounts/migrations/0003_auto_20150209_2234.py b/evennia/accounts/migrations/0003_auto_20150209_2234.py new file mode 100644 index 0000000000..ccdb2fb897 --- /dev/null +++ b/evennia/accounts/migrations/0003_auto_20150209_2234.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('accounts', '0002_move_defaults'), + ] + + operations = [ + migrations.CreateModel( + name='DefaultAccount', + fields=[ + ], + options={ + 'proxy': True, + }, + bases=('accounts.accountdb',), + ), + migrations.CreateModel( + name='DefaultGuest', + fields=[ + ], + options={ + 'proxy': True, + }, + bases=('accounts.defaultaccount',), + ), + migrations.AlterModelOptions( + name='accountdb', + options={'verbose_name': 'Account'}, + ), + ] diff --git a/evennia/accounts/migrations/0004_auto_20150403_2339.py b/evennia/accounts/migrations/0004_auto_20150403_2339.py new file mode 100644 index 0000000000..36d8110122 --- /dev/null +++ b/evennia/accounts/migrations/0004_auto_20150403_2339.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import evennia.accounts.manager +import django.core.validators + + +class Migration(migrations.Migration): + + dependencies = [ + ('accounts', '0003_auto_20150209_2234'), + ] + + operations = [ + migrations.DeleteModel( + name='DefaultGuest', + ), + migrations.DeleteModel( + name='DefaultAccount', + ), + migrations.AlterModelManagers( + name='accountdb', + managers=[ + (b'objects', evennia.accounts.manager.AccountDBManager()), + ], + ), + migrations.AlterField( + model_name='accountdb', + name='email', + field=models.EmailField(max_length=254, verbose_name='email address', blank=True), + ), + migrations.AlterField( + model_name='accountdb', + name='groups', + field=models.ManyToManyField(related_query_name='user', related_name='user_set', to='auth.Group', blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', verbose_name='groups'), + ), + migrations.AlterField( + model_name='accountdb', + name='last_login', + field=models.DateTimeField(null=True, verbose_name='last login', blank=True), + ), + migrations.AlterField( + model_name='accountdb', + name='username', + field=models.CharField(error_messages={'unique': 'A user with that username already exists.'}, max_length=30, validators=[django.core.validators.RegexValidator('^[\\w.@+-]+$', 'Enter a valid username. This value may contain only letters, numbers and @/./+/-/_ characters.', 'invalid')], help_text='Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.', unique=True, verbose_name='username'), + ), + ] diff --git a/evennia/accounts/migrations/0005_auto_20160905_0902.py b/evennia/accounts/migrations/0005_auto_20160905_0902.py new file mode 100644 index 0000000000..7ceaad2ac0 --- /dev/null +++ b/evennia/accounts/migrations/0005_auto_20160905_0902.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.9 on 2016-09-05 09:02 +from __future__ import unicode_literals + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('accounts', '0004_auto_20150403_2339'), + ] + + operations = [ + migrations.AlterField( + model_name='accountdb', + name='username', + field=models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=30, unique=True, validators=[django.core.validators.RegexValidator('^[\\w.@+-]+$', 'Enter a valid username. This value may contain only letters, numbers and @/./+/-/_ characters.')], verbose_name='username'), + ), + ] diff --git a/evennia/accounts/migrations/0006_auto_20170606_1731.py b/evennia/accounts/migrations/0006_auto_20170606_1731.py new file mode 100644 index 0000000000..e48114b23c --- /dev/null +++ b/evennia/accounts/migrations/0006_auto_20170606_1731.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.2 on 2017-06-06 17:31 +from __future__ import unicode_literals + +import django.contrib.auth.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('accounts', '0005_auto_20160905_0902'), + ] + + operations = [ + migrations.AlterField( + model_name='accountdb', + name='db_attributes', + field=models.ManyToManyField(help_text=b'attributes on this object. An attribute can hold any pickle-able python object (see docs for special cases).', to='typeclasses.Attribute'), + ), + migrations.AlterField( + model_name='accountdb', + name='db_tags', + field=models.ManyToManyField(help_text=b'tags on this object. Tags are simple string markers to identify, group and alias objects.', to='typeclasses.Tag'), + ), + migrations.AlterField( + model_name='accountdb', + name='username', + field=models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.ASCIIUsernameValidator()], verbose_name='username'), + ), + ] diff --git a/evennia/accounts/migrations/0002_copy_player_to_account.py b/evennia/accounts/migrations/0007_copy_player_to_account.py similarity index 97% rename from evennia/accounts/migrations/0002_copy_player_to_account.py rename to evennia/accounts/migrations/0007_copy_player_to_account.py index 5c32856c4b..ea1e00448c 100644 --- a/evennia/accounts/migrations/0002_copy_player_to_account.py +++ b/evennia/accounts/migrations/0007_copy_player_to_account.py @@ -47,7 +47,7 @@ def forwards(apps, schema_editor): class Migration(migrations.Migration): dependencies = [ - ('accounts', '0001_initial'), + ('accounts', '0006_auto_20170606_1731'), ] operations = [ diff --git a/evennia/accounts/migrations/__init__.py b/evennia/accounts/migrations/__init__.py index e69de29bb2..40a96afc6f 100644 --- a/evennia/accounts/migrations/__init__.py +++ b/evennia/accounts/migrations/__init__.py @@ -0,0 +1 @@ +# -*- coding: utf-8 -*- diff --git a/evennia/comms/migrations/0013_auto_20170705_1726.py b/evennia/comms/migrations/0013_auto_20170705_1726.py index 6076a12431..f74bf9566e 100644 --- a/evennia/comms/migrations/0013_auto_20170705_1726.py +++ b/evennia/comms/migrations/0013_auto_20170705_1726.py @@ -8,7 +8,7 @@ from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ('accounts', '0002_copy_player_to_account'), + ('accounts', '0007_copy_player_to_account'), ('comms', '0012_merge_20170617_2017'), ] diff --git a/evennia/objects/migrations/0007_objectdb_db_account.py b/evennia/objects/migrations/0007_objectdb_db_account.py index b27c75c944..4245a669bb 100644 --- a/evennia/objects/migrations/0007_objectdb_db_account.py +++ b/evennia/objects/migrations/0007_objectdb_db_account.py @@ -9,7 +9,7 @@ import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ - ('accounts', '0002_copy_player_to_account'), + ('accounts', '0007_copy_player_to_account'), ('objects', '0006_auto_20170606_1731'), ] diff --git a/evennia/scripts/migrations/0009_scriptdb_db_account.py b/evennia/scripts/migrations/0009_scriptdb_db_account.py index 99baf70a5f..427fb9c3f6 100644 --- a/evennia/scripts/migrations/0009_scriptdb_db_account.py +++ b/evennia/scripts/migrations/0009_scriptdb_db_account.py @@ -9,7 +9,7 @@ import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ - ('accounts', '0002_copy_player_to_account'), + ('accounts', '0007_copy_player_to_account'), ('scripts', '0008_auto_20170606_1731'), ]