natea / django-deployer

Deployment tool for Django that automatically generates the configuration to deploy your project to various PaaS providers.
http://natea.github.io/django-deployer
MIT License
150 stars 19 forks source link

Automate the creation of the database #15

Closed natea closed 11 years ago

natea commented 11 years ago

It looks like we can automate the create database step too using google_sql.py:

$ google_sql.py djangomezzanine:djangomezzdb
Google SQL Client

Type "help" or "?" for help.

Connecting to Google SQL database "djangomezzanine:djangomezzdb" on host None.
Using readline for history management.
Loading history file "/Users/nateaune/.googlesql/djangomezzanine:djangomezzdb.hist"
sql> create database djangodeployermezz;
Execution time: 0.138 seconds
1 row
sql> 

Or without requiring any user input:

$ echo "create database foobar;" | google_sql.py djangomezzanine:djangomezzdb
Google SQL Client

Type "help" or "?" for help.

Connecting to Google SQL database "djangomezzanine:djangomezzdb" on host None.
Using readline for history management.
Loading history file "/Users/nateaune/.googlesql/djangomezzanine:djangomezzdb.hist"
sql> Execution time: 0.147 seconds
1 row
sql> 
Bye.
littleq0903 commented 11 years ago

we have to detect whether the database exists already, or maybe we can leave this in manage.sh then user can decide when to do this action.

like

sh manage.sh createdatabase -> create database on CloudSQL

littleq0903 commented 11 years ago

now it's on master