Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
code.vt.edu will be down for maintenance from 0530-0630 EDT Wednesday, March 26th
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
a3e6e70e
Commit
a3e6e70e
authored
13 years ago
by
David Ormsbee
Browse files
Options
Downloads
Patches
Plain Diff
migration to change text fields to varchar and put indexes on them
parent
3cc72c84
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
user/migrations/0002_text_to_varchar_and_indexes.py
+35
-5
35 additions, 5 deletions
user/migrations/0002_text_to_varchar_and_indexes.py
user/models.py
+5
-5
5 additions, 5 deletions
user/models.py
with
40 additions
and
10 deletions
user/migrations/0002_
ad
d_indexes.py
→
user/migrations/0002_
text_to_varchar_an
d_indexes.py
+
35
−
5
View file @
a3e6e70e
...
...
@@ -8,12 +8,27 @@ class Migration(SchemaMigration):
def
forwards
(
self
,
orm
):
# Changing field 'UserProfile.name'
db
.
alter_column
(
'
auth_userprofile
'
,
'
name
'
,
self
.
gf
(
'
django.db.models.fields.CharField
'
)(
max_length
=
255
))
# Adding index on 'UserProfile', fields ['name']
db
.
create_index
(
'
auth_userprofile
'
,
[
'
name
'
])
# Changing field 'UserProfile.language'
db
.
alter_column
(
'
auth_userprofile
'
,
'
language
'
,
self
.
gf
(
'
django.db.models.fields.CharField
'
)(
max_length
=
255
))
# Adding index on 'UserProfile', fields ['language']
db
.
create_index
(
'
auth_userprofile
'
,
[
'
language
'
])
# Changing field 'UserProfile.courseware'
db
.
alter_column
(
'
auth_userprofile
'
,
'
courseware
'
,
self
.
gf
(
'
django.db.models.fields.CharField
'
)(
max_length
=
255
))
# Changing field 'UserProfile.meta'
db
.
alter_column
(
'
auth_userprofile
'
,
'
meta
'
,
self
.
gf
(
'
django.db.models.fields.CharField
'
)(
max_length
=
255
))
# Changing field 'UserProfile.location'
db
.
alter_column
(
'
auth_userprofile
'
,
'
location
'
,
self
.
gf
(
'
django.db.models.fields.CharField
'
)(
max_length
=
255
))
# Adding index on 'UserProfile', fields ['location']
db
.
create_index
(
'
auth_userprofile
'
,
[
'
location
'
])
...
...
@@ -29,6 +44,21 @@ class Migration(SchemaMigration):
# Removing index on 'UserProfile', fields ['name']
db
.
delete_index
(
'
auth_userprofile
'
,
[
'
name
'
])
# Changing field 'UserProfile.name'
db
.
alter_column
(
'
auth_userprofile
'
,
'
name
'
,
self
.
gf
(
'
django.db.models.fields.TextField
'
)())
# Changing field 'UserProfile.language'
db
.
alter_column
(
'
auth_userprofile
'
,
'
language
'
,
self
.
gf
(
'
django.db.models.fields.TextField
'
)())
# Changing field 'UserProfile.courseware'
db
.
alter_column
(
'
auth_userprofile
'
,
'
courseware
'
,
self
.
gf
(
'
django.db.models.fields.TextField
'
)())
# Changing field 'UserProfile.meta'
db
.
alter_column
(
'
auth_userprofile
'
,
'
meta
'
,
self
.
gf
(
'
django.db.models.fields.TextField
'
)())
# Changing field 'UserProfile.location'
db
.
alter_column
(
'
auth_userprofile
'
,
'
location
'
,
self
.
gf
(
'
django.db.models.fields.TextField
'
)())
models
=
{
'
auth.group
'
:
{
...
...
@@ -100,12 +130,12 @@ class Migration(SchemaMigration):
},
'
user.userprofile
'
:
{
'
Meta
'
:
{
'
object_name
'
:
'
UserProfile
'
,
'
db_table
'
:
"'
auth_userprofile
'"
},
'
courseware
'
:
(
'
django.db.models.fields.
Text
Field
'
,
[],
{
'
default
'
:
"'
course.xml
'"
,
'
blank
'
:
'
True
'
}),
'
courseware
'
:
(
'
django.db.models.fields.
Char
Field
'
,
[],
{
'
default
'
:
"'
course.xml
'"
,
'
max_length
'
:
'
255
'
,
'
blank
'
:
'
True
'
}),
'
id
'
:
(
'
django.db.models.fields.AutoField
'
,
[],
{
'
primary_key
'
:
'
True
'
}),
'
language
'
:
(
'
django.db.models.fields.
Text
Field
'
,
[],
{
'
db_index
'
:
'
True
'
,
'
blank
'
:
'
True
'
}),
'
location
'
:
(
'
django.db.models.fields.
Text
Field
'
,
[],
{
'
db_index
'
:
'
True
'
,
'
blank
'
:
'
True
'
}),
'
meta
'
:
(
'
django.db.models.fields.
Text
Field
'
,
[],
{
'
blank
'
:
'
True
'
}),
'
name
'
:
(
'
django.db.models.fields.
Text
Field
'
,
[],
{
'
db_index
'
:
'
True
'
,
'
blank
'
:
'
True
'
}),
'
language
'
:
(
'
django.db.models.fields.
Char
Field
'
,
[],
{
'
db_index
'
:
'
True
'
,
'
max_length
'
:
'
255
'
,
'
blank
'
:
'
True
'
}),
'
location
'
:
(
'
django.db.models.fields.
Char
Field
'
,
[],
{
'
db_index
'
:
'
True
'
,
'
max_length
'
:
'
255
'
,
'
blank
'
:
'
True
'
}),
'
meta
'
:
(
'
django.db.models.fields.
Char
Field
'
,
[],
{
'
max_length
'
:
'
255
'
,
'
blank
'
:
'
True
'
}),
'
name
'
:
(
'
django.db.models.fields.
Char
Field
'
,
[],
{
'
db_index
'
:
'
True
'
,
'
max_length
'
:
'
255
'
,
'
blank
'
:
'
True
'
}),
'
user
'
:
(
'
django.db.models.fields.related.ForeignKey
'
,
[],
{
'
to
'
:
"
orm[
'
auth.User
'
]
"
,
'
unique
'
:
'
True
'
})
}
}
...
...
This diff is collapsed.
Click to expand it.
user/models.py
+
5
−
5
View file @
a3e6e70e
...
...
@@ -21,11 +21,11 @@ class UserProfile(models.Model):
# Sanitize all fields.
# This is not visible to other users, but could introduce holes later
user
=
models
.
ForeignKey
(
User
,
unique
=
True
,
db_index
=
True
)
name
=
models
.
Text
Field
(
blank
=
True
,
db_index
=
True
)
language
=
models
.
Text
Field
(
blank
=
True
,
db_index
=
True
)
location
=
models
.
Text
Field
(
blank
=
True
,
db_index
=
True
)
meta
=
models
.
Text
Field
(
blank
=
True
)
# JSON dictionary for future expansion
courseware
=
models
.
Text
Field
(
blank
=
True
,
default
=
'
course.xml
'
)
name
=
models
.
Char
Field
(
blank
=
True
,
max_length
=
255
,
db_index
=
True
)
language
=
models
.
Char
Field
(
blank
=
True
,
max_length
=
255
,
db_index
=
True
)
location
=
models
.
Char
Field
(
blank
=
True
,
max_length
=
255
,
db_index
=
True
)
meta
=
models
.
Char
Field
(
blank
=
True
,
max_length
=
255
)
# JSON dictionary for future expansion
courseware
=
models
.
Char
Field
(
blank
=
True
,
max_length
=
255
,
default
=
'
course.xml
'
)
class
Registration
(
models
.
Model
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment