ElevatoDigital / dewdrop

Dewdrop makes writing complex WordPress plugins simpler by providing a sensible project layout and developer tools.
Other
11 stars 3 forks source link

Updates to gen-users-and-security-levels #106

Closed cornelisonc closed 6 years ago

cornelisonc commented 6 years ago

Fixed: The generated users table did not have a FK reference to the Security Levels table.

Added: Command now accepts args to automatically generate an admin user with provided name, email, and password, preventing the need for an extra deploy file just to add one.

griffbrad commented 6 years ago

If the admin user arguments are optional, what happens when I skip them? Won't the generated SQL file error out -- or at least produce a non-sensical, non-functional admin user?

cornelisonc commented 6 years ago

If no admin user arguments are provided, the command will work the same as it does now -- it will just generate the Users table without the Admin user (using *-create-users.sql).

If some admin user arguments are provided, but not all 3, the command will throw an error with a message saying that all admin user args must be provided if you are trying to generate an admin user.

If all 3 admin user args are provided, the *-create-users-with-admin-user.sql template is called instead of the *-create-users.sql template, as well as passing the admin user args to it.

griffbrad commented 6 years ago

I see. Can we modify it so that it doesn't duplicate the CREATE TABLE users; statement across the original template and the with-user template?

cornelisonc commented 6 years ago

How does this 👆🏼look @griffbrad ?

griffbrad commented 6 years ago

Merged!