lib/neo4j/migrations/base.rb in neo4j-8.1.4 vs lib/neo4j/migrations/base.rb in neo4j-8.1.5
- old
+ new
@@ -30,25 +30,27 @@
def migrate_up
schema = SchemaMigration.create!(migration_id: @migration_id, incomplete: true)
begin
run_migration(:up)
rescue StandardError => e
- schema.destroy
+ schema.destroy if transactions?
handle_migration_error!(e)
+ else
+ schema.update!(incomplete: nil)
end
- schema.update!(incomplete: nil)
end
def migrate_down
schema = SchemaMigration.find_by!(migration_id: @migration_id)
schema.update!(incomplete: true)
begin
run_migration(:down)
rescue StandardError => e
- schema.update!(incomplete: nil)
+ schema.update!(incomplete: nil) if transactions?
handle_migration_error!(e)
+ else
+ schema.destroy
end
- schema.destroy
end
def run_migration(direction)
migration_transaction { log_queries { public_send(direction) } }
end