Sha256: b541dd0748e577e5621af7fc74dd7b314c5ed08c9739255ec92c736f0a8014d7
Contents?: true
Size: 1.01 KB
Versions: 6
Compression:
Stored size: 1.01 KB
Contents
# frozen_string_literal: true require "snowpack/cli/application/command" module Snowpack module CLI module Application module Commands module DB module Structure class Dump < Command desc "Dumps database structure to db/structure.sql file" def call(*) measure("#{database_config.db_name} structure dumped to db/structure.sql") do cmd = "pg_dump --schema-only --no-owner #{Shellwords.escape(database_config.db_name)} > #{output_file}" system(database_config.cli_env_vars, cmd) end end private def database_config @database_config ||= Utils::DatabaseConfig.for_application(application) end def output_file "#{application.root}/db/structure.sql" end end end end register "db structure dump", DB::Structure::Dump end end end end
Version data entries
6 entries across 6 versions & 1 rubygems