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

[Bug] Install command counts user even with --no-interaction? #4663

Closed
tabacitu opened this issue Sep 13, 2022 · 5 comments · Fixed by #4670
Closed

[Bug] Install command counts user even with --no-interaction? #4663

tabacitu opened this issue Sep 13, 2022 · 5 comments · Fixed by #4670
Assignees
Labels
Possible Bug A bug that was reported but not confirmed yet. Priority: COULD Priority: SHOULD triage

Comments

@tabacitu
Copy link
Member

Developer report on email:

With this new version my DO app platform build fails. Before that I manually install backpack with 'php artisan backpack:install --no-interaction', and it was working fine. But now the build run with the appplatform build and fail like this:

STEP 1 Installing Backpack CRUD:
[2022-09-13 12:43:53]
[2022-09-13 12:43:57] Publishing configs, views, js and css files ............................ DONE
[2022-09-13 12:43:57] Creating users table ................................................... DONE
[2022-09-13 12:43:57] Creating CheckIfAdmin middleware ....................................... DONE
[2022-09-13 12:44:16] Installing Backpack Generators ......................................... DONE
[2022-09-13 12:44:16]
[2022-09-13 12:44:16] In Connection.php line 759:
[2022-09-13 12:44:16]
[2022-09-13 12:44:16] SQLSTATE[HY000] [2002] Connection refused (SQL: select count(*) as aggregat
[2022-09-13 12:44:16] e from users)

Do you have any suggestions? I know it can't connect to the managed db, but when I run php artisan migrate, it can migrate the files, so the DB connection is fine, at least after the build fails :S

@promatik - it looks to me like we're counting users, even if --no-interaction is run? Is this true? Or what could be the cause of this?

Thanks!

@tabacitu tabacitu added triage Possible Bug A bug that was reported but not confirmed yet. labels Sep 13, 2022
@tabacitu tabacitu moved this to No Status in Backpack v5.3 Sep 13, 2022
@promatik
Copy link
Contributor

promatik commented Sep 14, 2022

Wow, this is strange ...

Ok first, yes, even with --no-interaction it may count the users, because it's the default behaviour, count, and then it will default answer no to create admin users. But that is not an issue in my opinion...

Before that, the users table is created;

Image

How does the "Creating users table DONE" goes well, but the count gets a connection refused??? 🤨


I can remove the count when --no-interaction but this is a fix just for this user I think.

@promatik
Copy link
Contributor

@tabacitu can you please ask that user if his App\Models\User has a different connection or table?

class User extends Model {
    protected $connection = '???';
    protected $table = '???';
    ...

@promatik promatik assigned tabacitu and unassigned promatik Sep 14, 2022
@tabacitu
Copy link
Member Author

Asked, will come back with answer.

Yeah, let's not do that query if it's not necessary. What if people run it on a DB with 100M users? Unlikely but... not needed.

@tabacitu tabacitu assigned promatik and unassigned tabacitu Sep 15, 2022
@tabacitu tabacitu removed this from This week Sep 15, 2022
@tabacitu tabacitu moved this from No Status to Todo in Backpack v5.3 Sep 15, 2022
@pxpm
Copy link
Contributor

pxpm commented Sep 15, 2022

I told you guys from start that this user count is "pretty" but bound to bit us in the ass. #4559 (comment)

That query is never necessary, it's just a "beautification" that we really don't need.

Please consider removing it entirely. 🙃

Cheers

@promatik
Copy link
Contributor

@tabacitu @pxpm I was about to remove the info line, BUT 😅
This developer will have this error anyway, if it's not while counting, it's while inserting 🤷‍♂️

So I created this PR; #4670
That aims to solve the issue from it's root!

If you guys agree with it, this one may be closed 👌

Repository owner moved this from Todo to Done in Backpack v5.3 Oct 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Possible Bug A bug that was reported but not confirmed yet. Priority: COULD Priority: SHOULD triage
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants