前一个版本导入数据的时候
运行数据导入命令 python /edx/app/edxapp/edx-platform/manage.py lms migrate --settings aws
时候出现如下错误:
edxapp@edustackIronWood:~$ python /edx/app/edxapp/edx-platform/manage.py lms migrate --settings aws
WARNING:py.warnings:/edx/app/edxapp/edx-platform/lms/djangoapps/courseware/__init__.py:5: DeprecationWarning: Importing 'lms.djangoapps.courseware' as 'courseware' is no longer supported
warnings.warn("Importing 'lms.djangoapps.courseware' as 'courseware' is no longer supported", DeprecationWarning)
WARNING:root:DEPRECATION WARNING: aws.py has been deprecated, you should use production.py instead.
2019-05-12 22:48:20,776 WARNING 114837 [enterprise.utils] utils.py:50 - Could not import Registry from third_party_auth.provider
2019-05-12 22:48:20,777 WARNING 114837 [enterprise.utils] utils.py:51 - cannot import name _LTI_BACKENDS
System check identified some issues:
WARNINGS:
?: (mysql.W002) MySQL Strict Mode is not set for database connection 'default'
HINT: MySQL's Strict Mode fixes many data integrity problems in MySQL, such as data truncation upon insertion, by escalating warnings into errors. It is strongly recommended you activate it. See: https://docs.djangoproject.com/en/1.11/ref/databases/#mysql-sql-mode
?: (mysql.W002) MySQL Strict Mode is not set for database connection 'read_replica'
HINT: MySQL's Strict Mode fixes many data integrity problems in MySQL, such as data truncation upon insertion, by escalating warnings into errors. It is strongly recommended you activate it. See: https://docs.djangoproject.com/en/1.11/ref/databases/#mysql-sql-mode
?: (mysql.W002) MySQL Strict Mode is not set for database connection 'student_module_history'
HINT: MySQL's Strict Mode fixes many data integrity problems in MySQL, such as data truncation upon insertion, by escalating warnings into errors. It is strongly recommended you activate it. See: https://docs.djangoproject.com/en/1.11/ref/databases/#mysql-sql-mode
Operations to perform:
Apply all migrations: admin, api_admin, assessment, auth, badges, block_structure, bookmarks, branding, bulk_email, catalog, celery_utils, certificates, commerce, completion, consent, content_type_gating, contentserver, contenttypes, cors_csrf, course_action_state, course_duration_limits, course_goals, course_groups, course_modes, course_overviews, courseware, coursewarehistoryextended, crawlers, credentials, credit, dark_lang, database_fixups, degreed, django_comment_common, django_notify, django_openid_auth, djcelery, edx_oauth2_provider, edx_proctoring, edxval, email_marketing, embargo, enterprise, entitlements, experiments, external_auth, grades, instructor_task, integrated_channel, lms_xblock, microsite_configuration, milestones, mobile_api, notes, oauth2, oauth2_provider, oauth_dispatch, oauth_provider, organizations, programs, redirects, rss_proxy, sap_success_factors, schedules, self_paced, sessions, shoppingcart, site_configuration, sites, social_django, splash, static_replace, status, student, submissions, survey, teams, theming, third_party_auth, track, user_api, user_authn, util, verified_track_content, verify_student, video_config, video_pipeline, waffle, waffle_utils, wiki, workflow, xapi, xblock_django
Running migrations:
Applying admin.0002_logentry_remove_auto_add... OK
Applying api_admin.0007_delete_historical_api_records... OK
Applying assessment.0003_expand_course_id... OK
Applying auth.0007_alter_validators_add_error_messages... OK
Applying auth.0008_alter_user_username_max_length... OK
Applying block_structure.0001_config... OK
Applying block_structure.0002_blockstructuremodel... OK
Applying block_structure.0003_blockstructuremodel_storage... OK
Applying block_structure.0004_blockstructuremodel_usagekeywithrun... OK
Applying bulk_email.0006_course_mode_targets... OK
Applying catalog.0001_initial... OK
Applying catalog.0002_catalogintegration_username... OK
Applying catalog.0003_catalogintegration_page_size... OK
Applying catalog.0004_auto_20170616_0618... OK
Applying catalog.0005_catalogintegration_long_term_cache_ttl... OK
Applying djcelery.0001_initial...Traceback (most recent call last):
File "/edx/app/edxapp/edx-platform/manage.py", line 123, in <module>
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 364, 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 356, 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 283, in run_from_argv
self.execute(*args, **cmd_options)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute
output = self.handle(*args, **options)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 204, in handle
fake_initial=fake_initial,
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 115, in migrate
state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 145, in _migrate_all_forwards
state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 244, in apply_migration
state = migration.apply(state, schema_editor)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/migrations/migration.py", line 129, in apply
operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/migrations/operations/models.py", line 97, in database_forwards
schema_editor.create_model(model)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/backends/base/schema.py", line 319, in create_model
self.execute(sql, params or None)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/backends/base/schema.py", line 136, in execute
cursor.execute(sql, params)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/utils.py", line 94, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 62, in execute
return self.cursor.execute(sql)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/backends/mysql/base.py", line 101, in execute
return self.cursor.execute(query, args)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 205, in execute
self.errorhandler(self, exc, value)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
raise errorclass, errorvalue
django.db.utils.OperationalError: (1050, "Table 'djcelery_crontabschedule' already exists")
于是考虑先删除数据库然后再做数据表的迁移
执行迁移命令(python /edx/app/edxapp/edx-platform/manage.py lms migrate --settings aws
)后成功建立表
接下来考虑迁移cms数据表
下一步:准备导入数据
执行从老版edx中导入的sql文件
出现错误:
[Err] 1008 - Can't drop database 'dashboard'; database doesn't exist
[Err] -- MySQL dump 10.13 Distrib 5.6.33, for debian-linux-gnu (x86_64)
--
-- Host: localhost Database:
-- ------------------------------------------------------
-- Server version 5.6.33-0ubuntu0.14.04.1
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Current Database: `analytics-api`
--
DROP DATABASE `analytics-api` ;
DROP DATABASE `dashboard` ;
DROP DATABASE `ecommerce` ;
DROP DATABASE `edx_notes_api` ;
DROP DATABASE `edxapp` ;
DROP DATABASE `edxapp_csmh` ;
DROP DATABASE `reports` ;
DROP DATABASE `xqueue` ;
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `analytics-api` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `analytics-api`;
--
-- Table structure for table `auth_group`
--
DROP TABLE IF EXISTS `auth_group`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `auth_group` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(80) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `auth_group`
--
LOCK TABLES `auth_group` WRITE;
/*!40000 ALTER TABLE `auth_group` DISABLE KEYS */;
/*!40000 ALTER TABLE `auth_group` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `auth_group_permissions`
--
DROP TABLE IF EXISTS `auth_group_permissions`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `auth_group_permissions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`group_id` int(11) NOT NULL,
`permission_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `group_id` (`group_id`,`permission_id`),
KEY `auth_group__permission_id_1f49ccbbdc69d2fc_fk_auth_permission_id` (`permission_id`),
CONSTRAINT `auth_group__permission_id_1f49ccbbdc69d2fc_fk_auth_permission_id` FOREIGN KEY (`permission_id`) REFERENCES `auth_permission` (`id`),
CONSTRAINT `auth_group_permission_group_id_689710a9a73b7457_fk_auth_group_id` FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `auth_group_permissions`
--
LOCK TABLES `auth_group_permissions` WRITE;
/*!40000 ALTER TABLE `auth_group_permissions` DISABLE KEYS */;
/*!40000 ALTER TABLE `auth_group_permissions` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `auth_permission`
--
DROP TABLE IF EXISTS `auth_permission`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `auth_permission` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`content_type_id` int(11) NOT NULL,
`codename` varchar(100) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `content_type_id` (`content_type_id`,`codename`),
CONSTRAINT `auth__content_type_id_508cf46651277a81_fk_django_content_type_id` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=73 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `auth_permission`
--
LOCK TABLES `auth_permission` WRITE;
/*!40000 ALTER TABLE `auth_permission` DISABLE KEYS */;
INSERT INTO `auth_permission` VALUES (1,'Can add permission',1,'add_permission'),(2,'Can change permission',1,'change_permission'),(3,'Can delete permission',1,'delete_permission'),(4,'Can add group',2,'add_group'),(5,'Can chang
[Err] 1062 - Duplicate entry '7' for key 'PRIMARY'
[Err] --
-- Dumping data for table `django_content_type`
--
LOCK TABLES `django_content_type` WRITE;
/*!40000 ALTER TABLE `django_content_type` DISABLE KEYS */;
INSERT INTO `django_content_type` VALUES (7,'admin','logentry'),(2,'auth','group'),(1,'auth','permission'),(3,'auth','user'),(8,'authtoken','token'),(4,'contenttypes','contenttype'),(5,'sessions','session'),(6,'sites','site'),(9,'v0','courseactivityweekly'),(12,'v0','courseenrollmentbybirthyear'),(18,'v0','courseenrollmentbycountry'),(13,'v0','courseenrollmentbyeducation'),(14,'v0','courseenrollmentbygender'),(10,'v0','courseenrollmentdaily'),(11,'v0','courseenrollmentmodedaily'),(19,'v0','gradedistribution'),(23,'v0','moduleengagement'),(24,'v0','moduleengagementmetricranges'),(17,'v0','problemfirstlastresponseanswerdistribution'),(15,'v0','problemresponseanswerdistribution'),(16,'v0','problemsandtags'),(20,'v0','sequentialopendistribution'),(22,'v0','video'),(21,'v0','videotimeline');
/*!40000 ALTER TABLE `django_content_type` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `django_migrations`
--
DROP TABLE IF EXISTS `django_migrations`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `django_migrations` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`app` varchar(255) NOT NULL,
`name` varchar(255) NOT NULL,
`applied` datetime(6) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `django_migrations`
--
LOCK TABLES `django_migrations` WRITE;
/*!40000 ALTER TABLE `django_migrations` DISABLE KEYS */;
INSERT INTO `django_migrations` VALUES (1,'contenttypes','0001_initial','2016-10-16 02:38:54.445579'),(2,'auth','0001_initial','2016-10-16 02:38:54.716116'),(3,'admin','0001_initial','2016-10-16 02:38:54.794456'),(4,'contenttypes','0002_remove_content_type_name','2016-10-16 02:38:54.897425'),(5,'auth','0002_alter_permission_name_max_length','2016-10-16 02:38:54.936018'),(6,'auth','0003_alter_user_email_max_length','2016-10-16 02:38:54.976416'),(7,'auth','0004_alter_user_username_opts','2016-10-16 02:38:54.997320'),(8,'auth','0005_alter_user_last_login_null','2016-10-16 02:38:55.031251'),(9,'auth','0006_require_contenttypes_0002','2016-10-16 02:38:55.033063'),(10,'authtoken','0001_initial','2016-10-16 02:38:55.081215'),(11,'authtoken','0002_auto_20160226_1747','2016-10-16 02:38:55.200399'),(12,'sessions','0001_initial','2016-10-16 02:38:55.300990'),(13,'sites','0001_initial','2016-10-16 02:38:55.323607');
/*!40000 ALTER TABLE `django_migrations` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `django_session`
--
DROP TABLE IF EXISTS `django_session`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `django_session` (
`session_key` varchar(40) NOT NULL,
`session_data` longtext NOT NULL,
`expire_date` datetime(6) NOT NULL,
PRIMARY KEY (`session_key`),
KEY `django_session_de54fa62` (`expire_date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `django_session`
--
LOCK TABLES `django_session` WRITE;
/*!40000 ALTER TABLE `django_session` DISABLE KEYS */;
/*!40000 ALTER TABLE `django_session` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `django_site`
--
DROP TABLE IF EXISTS `django_site`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `django_site` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`domain` varchar(100) NOT NULL,
`name` varchar(50) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `django_site`
--
LOCK TABLES `django_site` WRITE;
/*!40000 ALTER TABLE `django_site` DISABLE KEYS */;
INSERT INTO `django_site` VALUES (1,'example.com','example.com');
/*!40000 ALTER TA
[Err] 1100 - Table 'auth_permission' was not locked with LOCK TABLES
[Err] /*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `auth_permission` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`content_type_id` int(11) NOT NULL,
`codename` varchar(100) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `auth_permission_content_type_id_01ab375a_uniq` (`content_type_id`,`codename`),
CONSTRAINT `auth_permissi_content_type_id_2f476e4b_fk_django_content_type_id` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=52 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `auth_permission`
--
LOCK TABLES `auth_permission` WRITE;
/*!40000 ALTER TABLE `auth_permission` DISABLE KEYS */;
INSERT INTO `auth_permission` VALUES (1,'Can add permission',1,'add_permission'),(2,'Can change permission',1,'change_permission'),(3,'Can delete permission',1,'delete_permission'),(4,'Can add group',2,'add_group'),(5,'Can change group',2,'change_group'),(6,'Can delete group',2,'delete_group'),(7,'Can add content type',3,'add_contenttype'),(8,'Can change content type',3,'change_contenttype'),(9,'Can delete content type',3,'delete_contenttype'),(10,'Can add session',4,'add_session'),(11,'Can change session',4,'change_session'),(12,'Can delete session',4,'delete_session'),(13,'Can add site',5,'add_site'),(14,'Can change site',5,'change_site'),(15,'Can delete site',5,'delete_site'),(16,'Can add log entry',6,'add_logentry'),(17,'Can change log entry',6,'change_logentry'),(18,'Can delete log entry',6,'delete_logentry'),(19,'Can add flag',7,'add_flag'),(20,'Can change flag',7,'change_flag'),(21,'Can delete flag',7,'delete_flag'),(22,'Can add switch',8,'add_switch'),(23,'Can change switch',8,'change_switch'),(24,'Can delete switch',8,'delete_switch'),(25,'Can add sample',9,'add_sample'),(26,'Can change sample',9,'change_sample'),(27,'Can delete sample',9,'delete_sample'),(28,'Can add announcement',10,'add_announcement'),(29,'Can change announcement',10,'change_announcement'),(30,'Can delete announcement',10,'delete_announcement'),(31,'Can add dismissal',11,'add_dismissal'),(32,'Can change dismissal',11,'change_dismissal'),(33,'Can delete dismissal',11,'delete_dismissal'),(34,'Can add user',12,'add_user'),(35,'Can change user',12,'change_user'),(36,'Can delete user',12,'delete_user'),(37,'Can add message',13,'add_message'),(38,'Can change message',13,'change_message'),(39,'Can delete message',13,'delete_message'),(40,'Can add user social auth',14,'add_usersocialauth'),(41,'Can change user social auth',14,'change_usersocialauth'),(42,'Can delete user social auth',14,'delete_usersocialauth'),(43,'Can add nonce',15,'add_nonce'),(44,'Can change nonce',15,'change_nonce'),(45,'Can delete nonce',15,'delete_nonce'),(46,'Can add association',16,'add_association'),(47,'Can change association',16,'change_association'),(48,'Can delete association',16,'delete_association'),(49,'Can add code',17,'add_code'),(50,'Can change code',17,'change_code'),(51,'Can delete code',17,'delete_code');
/*!40000 ALTER TABLE `auth_permission` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `django_admin_log`
--
DROP TABLE IF EXISTS `django_admin_log`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `django_admin_log` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`action_time` datetime(6) NOT NULL,
`object_id` longtext,
`object_repr` varchar(200) NOT NULL,
`action_flag` smallint(5) unsigned NOT NULL,
`change_message` longtext NOT NULL,
`content_type_id` int(11) DEFAULT NULL,
`user_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `django_admin__content_type_id_c4bce8eb_fk_django_content_type_id` (`content_type_id`),
KEY `django_admin_log_user_id_c564eba6_fk_analytics_dashboard_user_id` (`user_id`),
CONSTRAINT `django_admin__content_type_id_c4bce8eb_fk_django_content_type_id` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`),
CONSTRAI
[Err] 1100 - Table 'waffle_flag' was not locked with LOCK TABLES
[Err] /*!40000 ALTER TABLE `waffle_flag` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `waffle_flag_groups`
--
DROP TABLE IF EXISTS `waffle_flag_groups`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `waffle_flag_groups` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`flag_id` int(11) NOT NULL,
`group_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `waffle_flag_groups_flag_id_8ba0c71b_uniq` (`flag_id`,`group_id`),
KEY `waffle_flag_groups_group_id_a97c4f66_fk_auth_group_id` (`group_id`),
CONSTRAINT `waffle_flag_groups_flag_id_c11c0c05_fk_waffle_flag_id` FOREIGN KEY (`flag_id`) REFERENCES `waffle_flag` (`id`),
CONSTRAINT `waffle_flag_groups_group_id_a97c4f66_fk_auth_group_id` FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `waffle_flag_groups`
--
LOCK TABLES `waffle_flag_groups` WRITE;
/*!40000 ALTER TABLE `waffle_flag_groups` DISABLE KEYS */;
/*!40000 ALTER TABLE `waffle_flag_groups` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `waffle_flag_users`
--
DROP TABLE IF EXISTS `waffle_flag_users`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `waffle_flag_users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`flag_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `waffle_flag_users_flag_id_b46f76b0_uniq` (`flag_id`,`user_id`),
KEY `waffle_flag_user_user_id_8026df9b_fk_analytics_dashboard_user_id` (`user_id`),
CONSTRAINT `waffle_flag_user_user_id_8026df9b_fk_analytics_dashboard_user_id` FOREIGN KEY (`user_id`) REFERENCES `analytics_dashboard_user` (`id`),
CONSTRAINT `waffle_flag_users_flag_id_833c37b0_fk_waffle_flag_id` FOREIGN KEY (`flag_id`) REFERENCES `waffle_flag` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `waffle_flag_users`
--
LOCK TABLES `waffle_flag_users` WRITE;
/*!40000 ALTER TABLE `waffle_flag_users` DISABLE KEYS */;
/*!40000 ALTER TABLE `waffle_flag_users` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `waffle_sample`
--
DROP TABLE IF EXISTS `waffle_sample`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `waffle_sample` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`percent` decimal(4,1) NOT NULL,
`note` longtext NOT NULL,
`created` datetime(6) NOT NULL,
`modified` datetime(6) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`),
KEY `waffle_sample_e2fa5388` (`created`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `waffle_sample`
--
LOCK TABLES `waffle_sample` WRITE;
/*!40000 ALTER TABLE `waffle_sample` DISABLE KEYS */;
/*!40000 ALTER TABLE `waffle_sample` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `waffle_switch`
--
DROP TABLE IF EXISTS `waffle_switch`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `waffle_switch` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`active` tinyint(1) NOT NULL,
`note` longtext NOT NULL,
`created` datetime(6) NOT NULL,
`modified` datetime(6) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`),
KEY `waffle_switch_e2fa5388` (`created`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `waffle_switch`
--
LOCK TABLES `waffle_switch` WRITE;
/*!40000 ALTER TABLE `waffle_switch` DISABLE KEYS */;
/*!40000 ALTER TABLE `waffle_switch` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Current Database: `ecommerce`
--
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `ecommerce` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `ecommerc
[Err] 1215 - Cannot add foreign key constraint
[Err] CREATE TABLE `notify_settings` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`interval` smallint(6) NOT NULL,
`user_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `notify_settings_user_id_14e062dc3d4345b3_fk_auth_user_id` (`user_id`),
CONSTRAINT `notify_settings_user_id_14e062dc3d4345b3_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `notify_settings`
--
LOCK TABLES `notify_settings` WRITE;
/*!40000 ALTER TABLE `notify_settings` DISABLE KEYS */;
/*!40000 ALTER TABLE `notify_settings` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `notify_subscription`
--
DROP TABLE IF EXISTS `notify_subscription`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `notify_subscription` (
`subscription_id` int(11) NOT NULL AUTO_INCREMENT,
`object_id` varchar(64) DEFAULT NULL,
`send_emails` tinyint(1) NOT NULL,
`notification_type_id` varchar(128) NOT NULL,
`settings_id` int(11) NOT NULL,
PRIMARY KEY (`subscription_id`),
KEY `a2462650bbefc26547210b80dec61069` (`notification_type_id`),
KEY `notify_subscr_settings_id_64d594d127e8ca95_fk_notify_settings_id` (`settings_id`),
CONSTRAINT `a2462650bbefc26547210b80dec61069` FOREIGN KEY (`notification_type_id`) REFERENCES `notify_notificationtype` (`key`),
CONSTRAINT `notify_subscr_settings_id_64d594d127e8ca95_fk_notify_settings_id` FOREIGN KEY (`settings_id`) REFERENCES `notify_settings` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `notify_subscription`
--
LOCK TABLES `notify_subscription` WRITE;
/*!40000 ALTER TABLE `notify_subscription` DISABLE KEYS */;
/*!40000 ALTER TABLE `notify_subscription` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `oauth2_accesstoken`
--
DROP TABLE IF EXISTS `oauth2_accesstoken`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `oauth2_accesstoken` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`token` varchar(255) NOT NULL,
`expires` datetime(6) NOT NULL,
`scope` int(11) NOT NULL,
`client_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `oauth2_accesstoken_94a08da1` (`token`),
KEY `oauth2_accesstoken_2bfe9d72` (`client_id`),
KEY `oauth2_accesstoken_e8701ad4` (`user_id`),
CONSTRAINT `oauth2_accesstoke_client_id_20c73b03a7c139a2_fk_oauth2_client_id` FOREIGN KEY (`client_id`) REFERENCES `oauth2_client` (`id`),
CONSTRAINT `oauth2_accesstoken_user_id_7a865c7085722378_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=50 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `oauth2_accesstoken`
--
LOCK TABLES `oauth2_accesstoken` WRITE;
/*!40000 ALTER TABLE `oauth2_accesstoken` DISABLE KEYS */;
INSERT INTO `oauth2_accesstoken` VALUES (1,'3881f6ca43d8f07de861bc7d3f271a72209cf017','2016-12-04 13:00:41.103913',0,4,16),(2,'69c57e9d659beda22261d000e0260d56300411bc','2017-12-05 12:35:59.047163',47,5,8),(3,'1ea6b3d65fb324c24d0f57117397e482be00606b','2018-01-07 09:02:46.681058',47,5,8),(4,'c4f9af1e2393feed308acb3cc25add08a3114fe6','2018-01-07 09:04:11.309835',47,5,8),(5,'8f1b249c16322184dcf99b48b8feb900e41882a2','2018-01-09 03:42:39.531895',47,5,8),(6,'a2a0d5af90c9f3b4bfda1377a160096b3aa46dc5','2018-01-09 03:45:49.130474',47,5,8),(7,'3c5ec6b5f87e38f3436295968a0362e8c881e0fe','2018-01-09 03:46:25.649056',47,5,8),(8,'adad3854763cbcec6a1ba230b1e27913cdfa7ddf','2018-01-09 03:47:03.608805',47,5,8),(9,'34f55ff530ed90a0156112fd755e031554395711','2018-01-09 03:45:55.755100',47,5,8),(10,'24d5a905e9fa270d35101f85ef30494fa9ec2210','2018-01-09 03:49:47.907645',47,5,8),(11,'14ce0e2ec8e4516af3972f63a08dc93386d960fb','2018-01-09 03:50:17.685238',47,5,8),(12,'11d2315ed313bea0bc1e15c669cce69d3fb08226','2018-01-09 0
[Msg] Finished - Unsuccessfully
--------------------------------------------------
执行cms的migrate的时候,course_overview app中的cource_overview表中是有certificate_available_date字段的
而且cource_overview中的迁移文件确实被运行了
前台错误:edx不能登录
根据报错运行迁移:
python /edx/app/edxapp/edx-platform/manage.py lms migrate email_marketing --settings aws
迁移后能登录,但是出现了服务器500错误
查看log
python /edx/app/edxapp/edx-platform/manage.py lms migrate commerce --settings aws
依然报错:
OperationalError: (1054, "Unknown column 'verify_student_softwaresecurephotoverification.expiry_date' in 'field list'")
但是执行上述命令依旧报错,于是查看verify_student_ssoverification表,发现没有数据,所以决定删除表后重新migrate
django.db.utils.OperationalError: (1050, "Table 'verify_student_manualverification' already exists")
同上错误
依旧选择删除表,重新migrate
migrate命令不报错
刷新页面,发现log中出现以下报错:
OperationalError: (1054, "Unknown column 'programs_programsapiconfig.marketing_path' in 'field list'")
采取相同策略
最后成功解决。
但是退出登录后首页出现500
查看log
OperationalError: (1054, "Unknown column 'course_overviews_courseoverview.certificate_available_date' in 'field list'")
最后查看sql文件,发现以下代码
DROP TABLE IF EXISTS `course_overviews_courseoverview`;/*!40101 SET @saved_cs_client = @@character_set_client */;/*!40101 SET character_set_client = utf8 */;CREATE TABLE `course_overviews_courseoverview` ( `created` datetime(6) NOT NULL, `modified` datetime(6) NOT NULL, `version` int(11) NOT NULL, `id` varchar(255) NOT NULL, `_location` varchar(255) NOT NULL, `display_name` longtext, `display_number_with_default` longtext NOT NULL, `display_org_with_default` longtext NOT NULL, `start` datetime(6) DEFAULT NULL, `end` datetime(6) DEFAULT NULL, `advertised_start` longtext, `course_image_url` longtext NOT NULL, `social_sharing_url` longtext, `end_of_course_survey_url` longtext, `certificates_display_behavior` longtext, `certificates_show_before_end` tinyint(1) NOT NULL, `cert_html_view_enabled` tinyint(1) NOT NULL, `has_any_active_web_certificate` tinyint(1) NOT NULL, `cert_name_short` longtext NOT NULL, `cert_name_long` longtext NOT NULL, `lowest_passing_grade` decimal(5,2) DEFAULT NULL, `days_early_for_beta` double DEFAULT NULL, `mobile_available` tinyint(1) NOT NULL, `visible_to_staff_only` tinyint(1) NOT NULL, `_pre_requisite_courses_json` longtext NOT NULL, `enrollment_start` datetime(6) DEFAULT NULL, `enrollment_end` datetime(6) DEFAULT NULL, `enrollment_domain` longtext, `invitation_only` tinyint(1) NOT NULL, `max_student_enrollments_allowed` int(11) DEFAULT NULL, `announcement` datetime(6), `catalog_visibility` longtext, `course_video_url` longtext, `effort` longtext, `short_description` longtext, `org` longtext NOT NULL, `self_paced` tinyint(1) NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;/*!40101 SET character_set_client = @saved_cs_client */;
所以会出现版本更新后字段的丢失
third_party_auth app migrate的时候出现错误
django.db.utils.OperationalError: (1060, "Duplicate column name 'sync_learner_profile_data'")
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('third_party_auth', '0012_auto_20170626_1135'),
]
operations = [
migrations.AddField(
model_name='ltiproviderconfig',
name='sync_learner_profile_data',
field=models.BooleanField(default=False, help_text='Synchronize user profile data received from the identity provider with the edX user account on each SSO login. The user will be notified if the email address associated with their account is changed as a part of this synchronization.'),
),
migrations.AddField(
model_name='oauth2providerconfig',
name='sync_learner_profile_data',
field=models.BooleanField(default=False, help_text='Synchronize user profile data received from the identity provider with the edX user account on each SSO login. The user will be notified if the email address associated with their account is changed as a part of this synchronization.'),
),
migrations.AddField(
model_name='samlproviderconfig',
name='sync_learner_profile_data',
field=models.BooleanField(default=False, help_text='Synchronize user profile data received from the identity provider with the edX user account on each SSO login. The user will be notified if the email address associated with their account is changed as a part of this synchronization.'),
),
]
一样的字段出现三次,于是考虑只留下一个字段(0013xxx.py迁移文件)
执行migrate后,问题成功解决
可以正常登陆登出,其它功能还没有做测试
所以最后应该是sql文件有错误(不清楚为什么需要先删除表然后再建表)