Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling flox:db twice causes error #136

Closed
Protinon opened this issue Jan 23, 2020 · 2 comments
Closed

Calling flox:db twice causes error #136

Protinon opened this issue Jan 23, 2020 · 2 comments

Comments

@Protinon
Copy link

As the title says, when I call php artisan flox:db twice, it will ask for a admin username and password even though an account already exists. It throws an error as shown below. I haven't used this software for long, but when Flox gets updated I need to call this command again to update the database, correct?

I ask this because I'm creating a docker image and I call php artisan flox:db admin password so the database can be initialized (and updated, if needed), and to create a default login.

> php artisan flox:db admin password
TRYING TO MIGRATE DATABASE
Nothing to migrate.
MIGRATION COMPLETED

In Connection.php line 669:
                                                                               
  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'admi  
  n' for key 'users_username_unique' (SQL: insert into `users` (`username`, `  
  password`, `updated_at`, `created_at`) values (admin, $2y$10$lSOtTRAlNmEvZ2  
  cbFYXmwOemYbTNi2anhbBzXIabZVkGFmC3C6LuC, 2020-01-23 04:31:11, 2020-01-23 04  
  :31:11))                                                                     
                                                                               

In PDOStatement.php line 123:
                                                                               
  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'admi  
  n' for key 'users_username_unique'                                           
                                                                               

In PDOStatement.php line 121:
                                                                               
  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'admi  
  n' for key 'users_username_unique
@exane
Copy link
Collaborator

exane commented Jan 23, 2020

No, as you've noticed the command is not idempotent and should only be used once for initializing the DB.
What you probably want is php artisan migrate for updating.

@Protinon
Copy link
Author

Ah, missed that command completely, my bad. Thanks for the help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants