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
a3e6e70e
Commit
a3e6e70e
authored
Feb 02, 2012
by
David Ormsbee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
migration to change text fields to varchar and put indexes on them
parent
3cc72c84
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
10 deletions
+40
-10
user/migrations/0002_text_to_varchar_and_indexes.py
+35
-5
user/models.py
+5
-5
No files found.
user/migrations/0002_
ad
d_indexes.py
→
user/migrations/0002_
text_to_varchar_an
d_indexes.py
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.
TextField'
,
[],
{
'default'
:
"'course.xml'"
,
'blank'
:
'True'
}),
'courseware'
:
(
'django.db.models.fields.
CharField'
,
[],
{
'default'
:
"'course.xml'"
,
'max_length'
:
'255'
,
'blank'
:
'True'
}),
'id'
:
(
'django.db.models.fields.AutoField'
,
[],
{
'primary_key'
:
'True'
}),
'language'
:
(
'django.db.models.fields.
TextField'
,
[],
{
'db_index'
:
'True
'
,
'blank'
:
'True'
}),
'location'
:
(
'django.db.models.fields.
TextField'
,
[],
{
'db_index'
:
'True
'
,
'blank'
:
'True'
}),
'meta'
:
(
'django.db.models.fields.
TextField'
,
[],
{
'blank'
:
'True'
}),
'name'
:
(
'django.db.models.fields.
TextField'
,
[],
{
'db_index'
:
'True
'
,
'blank'
:
'True'
}),
'language'
:
(
'django.db.models.fields.
CharField'
,
[],
{
'db_index'
:
'True'
,
'max_length'
:
'255
'
,
'blank'
:
'True'
}),
'location'
:
(
'django.db.models.fields.
CharField'
,
[],
{
'db_index'
:
'True'
,
'max_length'
:
'255
'
,
'blank'
:
'True'
}),
'meta'
:
(
'django.db.models.fields.
CharField'
,
[],
{
'max_length'
:
'255'
,
'blank'
:
'True'
}),
'name'
:
(
'django.db.models.fields.
CharField'
,
[],
{
'db_index'
:
'True'
,
'max_length'
:
'255
'
,
'blank'
:
'True'
}),
'user'
:
(
'django.db.models.fields.related.ForeignKey'
,
[],
{
'to'
:
"orm['auth.User']"
,
'unique'
:
'True'
})
}
}
...
...
user/models.py
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
.
TextField
(
blank
=
True
,
db_index
=
True
)
language
=
models
.
TextField
(
blank
=
True
,
db_index
=
True
)
location
=
models
.
TextField
(
blank
=
True
,
db_index
=
True
)
meta
=
models
.
TextField
(
blank
=
True
)
# JSON dictionary for future expansion
courseware
=
models
.
TextField
(
blank
=
True
,
default
=
'course.xml'
)
name
=
models
.
CharField
(
blank
=
True
,
max_length
=
255
,
db_index
=
True
)
language
=
models
.
CharField
(
blank
=
True
,
max_length
=
255
,
db_index
=
True
)
location
=
models
.
CharField
(
blank
=
True
,
max_length
=
255
,
db_index
=
True
)
meta
=
models
.
CharField
(
blank
=
True
,
max_length
=
255
)
# JSON dictionary for future expansion
courseware
=
models
.
CharField
(
blank
=
True
,
max_length
=
255
,
default
=
'course.xml'
)
class
Registration
(
models
.
Model
):
...
...
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