Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi all,
I was thinking that should be interesting to tune the drush's quickstart-create command to allow the creation of sites using PostgreSQL database.
Greetings,
Comment | File | Size | Author |
---|---|---|---|
#4 | quickstart-pgsql_support-847214-4.patch | 13.2 KB | laceysanderson |
Comments
Comment #1
MichaelCole CreditAttribution: MichaelCole commentedHi Davfigue,
This is an interesting idea, but I don't have time to devote to it. Would you be interested in submitting a patch?
-- Mike
Comment #2
MichaelCole CreditAttribution: MichaelCole commentedComment #3
MichaelCole CreditAttribution: MichaelCole commentedHi, I won't get around to this, but would accept a patch if it was submitted.
Comment #4
laceysanderson CreditAttribution: laceysanderson commentedSince I needed this functionality (the ability to create drupal sites with PostgreSQL backends for debugging purposes), I thought I might as well create a patch back to this project as requested. This is my first patch so hopefully it works!
I've tried my best to stay with the style of the quickstart module and have added to the drush quickstart-create and drush quickstart-destroy commands. I also added to the drush help to document a new option db-backend with can be either "pgsql" or "mysql" but defaults to "mysql". Thus if the --db-backend option is not supplied, the default behaviour is exactly what it was before these changes were made making them backward compatible.
This works when the "all" argument is supplied to either drush command as well as the "database" argument.
One small gotcha is that on site-install drush asks for the password of the newly created pgsql user in order to drop/re-create the database. This is because psql (the postgresql command-line utility) does not allow supplying a password automatically. I've added a drush_print that explains this to the user and supplies the password of the pgsql user so that they can just copy/paste in order to hopefully alleviate any confusion...
Anyway, just let me know if there are any problems or any other functionality I should have included and I'll see what I can do :)
~Lacey
Comment #5
laceysanderson CreditAttribution: laceysanderson commentedOh, and I documented how I set up postgresql 8.4 on the quickstart VM. Here are the step-by-step instructions:
1) First I installed postgresql:
sudo apt-get install postgresql libpq-dev
2) Then I set the postgres user to have a password of quickstart
3) Set PostgreSQL to allow connections from apache by editing /etc/postgresql/8.4/main/pg_hba.conf
a) Comment out the following line by prefixing a #:
local all all ident
b) Add the following lines:
4) Restart postgresql so that the above changes can take place
sudo service postgresql restart
And that's it!
NOTE: The quickstart pgsql user is the one used by the drush commands and by setting the access permissions to ident it ensures that only the ubuntu quickstart user can login to psql using it and also that the quickstart user doesn't need to supply a password. This is what allows the create/destroy database commands to happen without a password prompt.
Comment #6
laceysanderson CreditAttribution: laceysanderson commentedMoving this over to drush since that's the main functionality added by the patch.