mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 15:48:43 -05:00
FIX: do not rollback imports unless data has been changed
This commit is contained in:
parent
c316894167
commit
7a621d97b9
1 changed files with 4 additions and 1 deletions
|
@ -93,6 +93,7 @@ module Import
|
||||||
|
|
||||||
def initialize_state
|
def initialize_state
|
||||||
@success = false
|
@success = false
|
||||||
|
@db_was_changed = false
|
||||||
@current_db = RailsMultisite::ConnectionManagement.current_db
|
@current_db = RailsMultisite::ConnectionManagement.current_db
|
||||||
@current_version = BackupRestore.current_version
|
@current_version = BackupRestore.current_version
|
||||||
@timestamp = Time.now.strftime("%Y-%m-%d-%H%M%S")
|
@timestamp = Time.now.strftime("%Y-%m-%d-%H%M%S")
|
||||||
|
@ -244,6 +245,8 @@ module Import
|
||||||
"COMMIT;"
|
"COMMIT;"
|
||||||
].join("\n")
|
].join("\n")
|
||||||
|
|
||||||
|
@db_was_changed = true
|
||||||
|
|
||||||
User.exec_sql(sql)
|
User.exec_sql(sql)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -275,7 +278,7 @@ module Import
|
||||||
|
|
||||||
def rollback
|
def rollback
|
||||||
log "Trying to rollback..."
|
log "Trying to rollback..."
|
||||||
if BackupRestore.can_rollback?
|
if @db_was_changed && BackupRestore.can_rollback?
|
||||||
log "Rolling back..."
|
log "Rolling back..."
|
||||||
BackupRestore.move_tables_between_schemas("backup", "public")
|
BackupRestore.move_tables_between_schemas("backup", "public")
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue