Sha256: ed12c169aa2b567c0e61a1910879db9ca5690e6ab727710965a0b79771403ce6
Contents?: true
Size: 552 Bytes
Versions: 30
Compression:
Stored size: 552 Bytes
Contents
module Litestream class RestorationsController < ApplicationController # POST /restorations def create database = params[:database].remove("[ROOT]/") dir, file = File.split(database) ext = File.extname(file) base = File.basename(file, ext) now = Time.now.utc.strftime("%Y%m%d%H%M%S") backup = File.join(dir, "#{base}-#{now}#{ext}") Litestream::Commands.restore(database, async: false, **{"-o" => backup}) redirect_to root_path, notice: "Restored to <code>#{backup}</code>." end end end
Version data entries
30 entries across 30 versions & 1 rubygems