Sha256: 17db1ce16189c0639129933dedbc39e8facbe1ee98dca37ef1351c4d3be279ff

Contents?: true

Size: 1.33 KB

Versions: 5

Compression:

Stored size: 1.33 KB

Contents

require_relative "base"

module Suspenders
  class ImportDumpGenerator < Generators::Base
    def copy_script
      template "bin_import_dump.erb", "bin/import_dump"
      chmod "bin/import_dump", 0o755
    end

    def inform_user
      instructions = <<~MARKDOWN

        ## Importing a dump from Heroku

        If you have configured the heroku remotes successfully,
        you can import a fresh dump from staging or production with:

            % ./bin/import_dump staging
            % ./bin/import_dump production

        ## Resetting a database

        If you want to reset (destroy and recreate) a database on Heroku, you
        cannot use `heroku run rake db:drop`, instead use:

            % heroku pg:reset DATABASE_URL --remote=staging

        ( source: https://devcenter.heroku.com/articles/heroku-postgresql#pg-reset )

        To load schema and seeds, you cannot use `heroku run rake db:setup`, instead use:

            % heroku run rails db:schema:load db:seed --remote=staging

        Remember to create a new backup schedule on Heroku after you reset your database!

            % heroku pg:backups:schedule DATABASE_URL --at '2:00 UTC' --remote=staging

        ( source: https://devcenter.heroku.com/articles/heroku-postgres-backups#scheduling-backups )

      MARKDOWN

      append_file "README.md", instructions
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
welaika-suspenders-3.0 lib/suspenders/generators/import_dump_generator.rb
welaika-suspenders-2.36 lib/suspenders/generators/import_dump_generator.rb
welaika-suspenders-2.35 lib/suspenders/generators/import_dump_generator.rb
welaika-suspenders-2.34 lib/suspenders/generators/import_dump_generator.rb
welaika-suspenders-2.33 lib/suspenders/generators/import_dump_generator.rb