Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
a7a1affb
Commit
a7a1affb
authored
Feb 26, 2016
by
Ned Batchelder
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11676 from edx/jibsheet/facebook_url_noop_migration
Noop the 0008 and conditional the 0009 migration
parents
daadc1e4
7a129b0e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
8 deletions
+14
-8
openedx/core/djangoapps/content/course_overviews/migrations/0008_remove_courseoverview_facebook_url.py
+2
-4
openedx/core/djangoapps/content/course_overviews/migrations/0009_readd_facebook_url.py
+12
-4
No files found.
openedx/core/djangoapps/content/course_overviews/migrations/0008_remove_courseoverview_facebook_url.py
View file @
a7a1affb
...
...
@@ -11,8 +11,6 @@ class Migration(migrations.Migration):
]
operations
=
[
migrations
.
RemoveField
(
model_name
=
'courseoverview'
,
name
=
'facebook_url'
,
),
# Removed because we accidentally removed this column without first
# removing the code that refers to this. This can cause errors in production.
]
openedx/core/djangoapps/content/course_overviews/migrations/0009_readd_facebook_url.py
View file @
a7a1affb
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
from
django.db
import
migrations
,
models
,
OperationalError
,
connection
from
openedx.core.djangoapps.content.course_overviews.models
import
CourseOverview
class
Migration
(
migrations
.
Migration
):
...
...
@@ -10,10 +11,17 @@ class Migration(migrations.Migration):
(
'course_overviews'
,
'0008_remove_courseoverview_facebook_url'
),
]
operations
=
[
migrations
.
AddField
(
# An original version of 0008 removed the facebook_url field
# We need to handle the case where our noop 0008 ran AND the case
# where the original 0008 ran. We do that by using Django's introspection
# API to query INFORMATION_SCHEMA. _meta is unavailable as the
# column has already been removed from the model.
fields
=
connection
.
introspection
.
get_table_description
(
connection
.
cursor
(),
'course_overviews_courseoverview'
)
operations
=
[]
if
not
any
(
f
.
name
==
'facebook_url'
for
f
in
fields
):
operations
+=
migrations
.
AddField
(
model_name
=
'courseoverview'
,
name
=
'facebook_url'
,
field
=
models
.
TextField
(
null
=
True
),
),
]
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment