Unable to Reset Heroku Shared Database
I just got this feedback from Heroku support:
Hi, this is due to a bug in the heroku client. An updated release should be out later today >or monday.
You may want to instead take this opportunity to try out the new dev databases:
https://postgres.heroku.com/blog/past/2012/4/26/heroku_postgres_development_plan/June 08, 2012 09:47
Looks like you have to wait around or use the dev databases.
Heroku: reinitialize database for Phoenix
From what I remember, Heroku don't let you 'drop' databases but do have built in commands that do let you reset the database.
If you have the CLI toolkit for heroku you should be able to run these commands:
heroku pg:reset DATABASE_NAME
Then you can run
heroku run mix ecto.migrate
This should reset all of your counters and everything else you were after.
For more info, have a look at this link here on Heroku's website
adding migration to heroku forces reset?
forgot about this question..
after rake run db:migrate
you must do heroku restart
for the schema changes to take affect.
Database problems with Heroku/Django: won't keep information after every push
Heroku's filesystem is ephemeral: any changes you make to files will be lost the next time your dyno restarts, which happens frequently (at least once per day). Since SQLite is a file-based database it is incompatible with Heroku.
You can use a client-server database instead. Heroku's own PostgreSQL add-on should be already set up for you, but you can use any of several others if you prefer.
dj-database-url
can simplify this for you: it lets you set your database configuration up from the DATABASE_URL
environment variable, which should already be set up by Heroku Postgres.
Here's an example of how to use dj-database-url
to use the DATABASE_URL
environment variable if it's present and fall back to another database if it isn't:
DATABASES['default'] = dj_database_url.config(default='sqlite://db.sqlite3')
I've shown an example that falls back to SQLite, but in reality I strongy recommend using the same database engine in all of your environments. Django's ORM helps "even out" different database engines, but there are still differences. You don't want to be in a position where your code works locally with SQLite, but fails in production with PostgreSQL.
Heroku rake db:migrate does not create tables (Rails 5)
rake db:migrate
won't load the schema.rb
file. It'll only run the migrations. If you want to load the schema then you can use rake db:schema:load
.
You might also need to be careful if you reinstate your migrations to run again as the schema_migrations
table probably has a record of all your migrations having run already. You'd need to clear that table too (delete the records - not drop the table) in order to indicate that your migrations should run again.
Related Topics
How to Get Systemd to Restart Rails App with Puma
How to Refresh a Page with Turbolinks
How Do Get a Random Datetime Rounded to Beginning of Hour in Rails
Cloning an Array with Its Content
Can You Create/Write/Append a String to a File in a Single Line in Ruby
How to Profile Rspec with Perftools and Bundler
What Is The Logic Behind This Result
How to Get Ruby-Debug-Ide to Work
How to Download a Ruby Gem Without Installing It Automatically
Best Way to Use HTML5 Data Attributes with Rails Content_Tag Helper
Factory_Girl + Rspec Doesn't Seem to Roll Back Changes After Each Example
Package Configuration for Libffi Is Not Found in MACos While Installing Travis-Cli
Celluloid Async Inside Ruby Blocks Does Not Work
Ruby Inject with Index and Brackets