Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
d0891d38
authored
Jul 21, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: fix migrations
parent
f19b455c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
11 deletions
+24
-11
circle/vm/migrations/0023_auto__del_unique_instancetemplate_n.py
+5
-3
circle/vm/migrations/0024_auto__del_field_instanceactivity_result__add_field_instanceactivity_re.py
+19
-8
No files found.
circle/vm/migrations/0023_auto__del_unique_instancetemplate_n.py
View file @
d0891d38
...
...
@@ -9,7 +9,10 @@ class Migration(SchemaMigration):
def
forwards
(
self
,
orm
):
# Removing unique constraint on 'InstanceTemplate', fields ['name']
db
.
delete_unique
(
u'vm_instancetemplate'
,
[
'name'
])
try
:
db
.
delete_unique
(
u'vm_instancetemplate'
,
[
'name'
])
except
Exception
as
e
:
print
unicode
(
e
)
# Changing field 'InstanceTemplate.parent'
...
...
@@ -281,4 +284,4 @@ class Migration(SchemaMigration):
}
}
complete_apps
=
[
'vm'
]
\ No newline at end of file
complete_apps
=
[
'vm'
]
circle/vm/migrations/0024_auto__del_field_instanceactivity_result__add_field_instanceactivity_re.py
View file @
d0891d38
...
...
@@ -7,34 +7,45 @@ class Migration(SchemaMigration):
def
forwards
(
self
,
orm
):
db
.
start_transaction
()
# Adding field 'InstanceActivity.result_data'
db
.
add_column
(
u'vm_instanceactivity'
,
'result_data'
,
self
.
gf
(
'jsonfield.fields.JSONField'
)(
null
=
True
,
blank
=
True
),
keep_default
=
False
)
# Adding field 'NodeActivity.result_data'
db
.
add_column
(
u'vm_nodeactivity'
,
'result_data'
,
self
.
gf
(
'jsonfield.fields.JSONField'
)(
null
=
True
,
blank
=
True
),
keep_default
=
False
)
db
.
commit_transaction
()
db
.
start_transaction
()
for
i
in
orm
.
InstanceActivity
.
objects
.
all
():
result
=
i
.
result
.
replace
(
"
%
"
,
"
%%
"
)
if
i
.
result
else
""
i
.
result_data
=
{
"user_text_template"
:
""
,
"admin_text_template"
:
result
,
"params"
:
{}}
i
.
save
()
# Deleting field 'InstanceActivity.result'
db
.
delete_column
(
u'vm_instanceactivity'
,
'result'
)
# Adding field 'NodeActivity.result_data'
db
.
add_column
(
u'vm_nodeactivity'
,
'result_data'
,
self
.
gf
(
'jsonfield.fields.JSONField'
)(
null
=
True
,
blank
=
True
),
keep_default
=
False
)
for
i
in
orm
.
NodeActivity
.
objects
.
all
():
result
=
i
.
result
.
replace
(
"
%
"
,
"
%%
"
)
if
i
.
result
else
""
i
.
result_data
=
{
"user_text_template"
:
""
,
"admin_text_template"
:
result
,
"params"
:
{}}
i
.
save
()
db
.
commit_transaction
()
db
.
start_transaction
()
# Deleting field 'InstanceActivity.result'
db
.
delete_column
(
u'vm_instanceactivity'
,
'result'
)
# Deleting field 'NodeActivity.result'
db
.
delete_column
(
u'vm_nodeactivity'
,
'result'
)
db
.
commit_transaction
()
def
backwards
(
self
,
orm
):
# Adding field 'InstanceActivity.result'
...
...
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