redmine - restore admin user after a db:reset - redmine

I installed Redmine locally to practice configuring it. After a while, I ran
bundle exec rake db:reset db:migrate RAILS_ENV=production
to reset the database and start over. Now if I try to login, Redmine no longer has the default root user (user = admin, password = admin). This is the default user created during the initial install.
Should I have used some other way to clear the database that would have left me a Redmine admin user?
How do I now add an admin user to Redmine? I can access the MySql database by using the console.

Related

FATAL: password authentication failed for user 'xxx' error when migrating to a postgresql db in RDS

I am trying to migrate to a PostgreSQL db in RDS from Django. The db was set up successfully but when I run python3 manage.py migrate I keep getting the error 'FATAL: password authentication failed for user'. The user name that it mentions is not the master username from RDS which is the same as my USER in settings. I have a .env file with the USER, ENGINE, PASSWORD etc that is being read correctly apart from the fact that it is not referencing the USER. It is referencing the username I use to log onto the computer which I also used when I set up a superuser in the venv.
I have tried logging out from superuser which did nothing. I also tried deactivating the venv which seemed to solve the authentication issue though obviously none of the modules within the venv uploaded so I got errors from that.
I tried changing the password in RDS but it is still trying to connect using the wrong user. I also tried making a new venv but still got the same error. The NAME in settings is set to postgres.
Has anyone else had this issue?

django postgres integration error, no such table - auth user

After updating the django settings.py default database to correct values.
i am able to run makemigrations and migrate command and also create super user. but when i login to the admin it gives me error of “no such table - auth user, OPERATIONAL ERROR”.
I noticed that even if i delete db.sqlite3 file, it comes back when i try to login, i think django looks for table in db.sqlite3 and not postgres.
why db.sqlite3 file re appear after deleting ?
how do i correctly configure my settings.py ?
i am integration using digitalocean managed database services with django installed in one droplet, i have integrated both preciously without error but i installed postgres, this is the first time using managed database service.
Thanks
It seems that your django settings are still pointing to the SQlite database.
Did you reload your WSGI process ? If not, the old SQlite settings are still used in memory.

Add admin user to ActiveAdmin

I've recently uploaded my websapp to heroku.
When I was developing on Cloud9, I added admin user to ActiveAdmin.
The problem is that I was using sqlite in a development environment, but now using postgresql in a production environment, and so the admin data I added when using sqlite was deleted and cannot login as an admin.
I would like you to tell me how to add a new admin in a production environment.
You can create new user by directly through rails console using,
heroku run rails console --app <app name>
AdminUser.create(login: 'default_login', password: 'default_password')
I would rather suggest you to write seed.rb file containing default database insert to bootstart your application.

Why won't my database reset using django_extensions, postgres, and psycopg2?

I am using django-extensions reset_db command and get the following error:
psycopg2.ProgrammingError: database "database_name" already exists
I've verified that my user has CreateDB and Login privileges. All packages are up to date. How can I tell why it's not able to reset the database correctly?
It turned out my user was not the owner of the database - the postgres superuser was.
I changed the owner of the database to my Django user and the reset_db command worked:
ALTER DATABASE database_name OWNER TO owner_name;

Restore heroku postgres password

How to recover a password for my heroku postgresql database? I used this command heroku pg:credentials DATABASE --reset but can't gain access to my django admin.
You can see your current credentials with heroku pg:credentials DATABASE or heroku config. You can then use the elements of the URL displayed to connect via a DB admin tool like Pgadmin. The password is the text between the : and the #.