開発

Open edXデータベース調査メモ


コマンド

python /edx/app/edxapp/edx-platform/manage.py lms syncdb --migrate --settings=aws

エラー


  File "/edx/app/edxapp/edx-platform/manage.py", line 116, in 
    execute_from_command_line([sys.argv[0]] + django_args)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
    utility.execute()
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/management/base.py", line 196, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/management/base.py", line 371, in handle
    return self.handle_noargs(**options)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/south/management/commands/syncdb.py", line 103, in handle_noargs
    management.call_command('migrate', **options)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 150, in call_command
    return klass.execute(*args, **defaults)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/south/management/commands/migrate.py", line 111, in handle
    ignore_ghosts = ignore_ghosts,
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/south/migration/__init__.py", line 200, in migrate_app
    applied_all = check_migration_histories(applied_all, delete_ghosts, ignore_ghosts)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/south/migration/__init__.py", line 81, in check_migration_histories
    m = h.get_migration()
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/south/models.py", line 40, in get_migration
    return self.get_migrations().migration(self.migration)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/south/models.py", line 37, in get_migrations
    return Migrations(self.app_name)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/south/migration/base.py", line 64, in call
    self.instances[app_label] = super(MigrationsMetaclass, self).__call__(app_label_to_app_module(app_label), **kwds)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/south/migration/base.py", line 90, in init
    self.set_application(application, force_creation, verbose_creation)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/south/migration/base.py", line 170, in set_application
    raise exceptions.NoMigrations(application)
south.exceptions.NoMigrations: Application '<module 'djcelery' from '/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/djcelery/__init__.pyc'>' has no migrations.

いろいろと調べたけれど、原因はマイグレーション履歴にあった。

以下、調査内容。

database – South migration error: NoMigrations exception for django.contrib.auth – Stack Overflow
Djangoの事例。edXではない。

TASK: [edxapp | syncdb and migrate] Error – Google グループ
migrationファイルの作成で失敗しているという話。いろいろと対処法が書いてある。

Export users failed with error “Permission denied: ‘transfer_users.txt'” – Google グループ
同じ
File “/edx/app/edxapp/edx-platform/manage.py”, line 116, in
のエラーの対処法。どうも権限がないという話。

development_environment [Wiki]

NoMigrations: Application '' has no migrations.

のエラー対処。

Go to your vm executing vagrant ssh and sudo su edxapp.
Log into mysql and execute the following command in the edxapp database:
Select * from south_migrationhistory where app_name = 'linkedin’;
If the query returns any result, execute: delete from south_migrationhistory where id = ;

linkedinのエラーだけど、同じことが原因かも。

remove a migration from south migration history

delete from south_migrationhistory where app_name='robots';

[TNL-3762] fix edx-ora2 issues with libraries – JIRA
これは関係あるかなあ。

5. Student Info and Progress Data — edX Research Guide documentation
Cypressの生徒のデータベースの情報。

6. Course Content Data — edX Research Guide documentation
Cypressのコースのデータベースの情報。

Moving databases from Aspen to Birch problems? – Google グループ
AspenからBirchへDBを移行した時の例。

mysqldump -u root -p --all-databases > ./backup.sql
mongodump -o ./mongo-backup


On my new Birch database server I ran the following commands:

mysql -u root -p < ./backup.sql
mongorestore -drop ./mongo-backup


Finally, I ran the following commands:

cd /edx/app/edxapp/edx-platform
sudo -u www-data /edx/bin/python.edxapp ./manage.py lms syncdb --migrate --settings aws
sudo -u www-data /edx/bin/python.edxapp ./manage.py cms syncdb --migrate --settings aws

Data Migration From Aspen to Birch - Google グループ
AspenからBirchへDBを移行した時の例。

mongodump -o ./mongo-backup
mongorestore -drop ./mongo-backup
mysqldump -u root -p --all-databases > ./backup.sql
mysql -u root -p < ./backup.sql

problem with current aspen.1 configuration? - Google グループ
Aspenのインストールで、データベースのエラー。

ubuntu@ip-10-0-0-230:~$ sudo mongo

MongoDB shell version: 2.6.5

connecting to: test

> show users

> use edxapp

switched to db edxapp

> show users

> db.addUser({user: "edxapp", pwd: "password", roles: ["readWrite", "dbAdmin"] })

WARNING: The 'addUser' shell helper is DEPRECATED. Please use 'createUser' instead

Successfully added user: { "user" : "edxapp", "roles" : [ "readWrite", "dbAdmin" ] }

> show users

{

"_id" : "edxapp.edxapp",

"user" : "edxapp",

"db" : "edxapp",

"roles" : [

{

"role" : "readWrite",

"db" : "edxapp"

},

{

"role" : "dbAdmin",

"db" : "edxapp"

}

]

}

> quit ()