Skip to content
This repository has been archived by the owner on Oct 7, 2021. It is now read-only.

Commit

Permalink
Added schematic.
Browse files Browse the repository at this point in the history
  • Loading branch information
Fred Wenzel committed Jan 7, 2011
1 parent eafc1be commit 5527311
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/libs.rst
Expand Up @@ -16,7 +16,7 @@ Database


* `django-multidb-router <https://github.com/jbalogh/django-multidb-router>`_: * `django-multidb-router <https://github.com/jbalogh/django-multidb-router>`_:
Round-robin master/slave db router for Django 1.2. Round-robin master/slave db router for Django 1.2.
* `schematic <https://github.com/jbalogh/schematic>`_: * `schematic <https://github.com/jbalogh/schematic>`_\*:
Simple database migration tool. Simple database migration tool.


Deferred Execution (cron, message queues) Deferred Execution (cron, message queues)
Expand Down
5 changes: 5 additions & 0 deletions manage.py
Expand Up @@ -38,6 +38,11 @@
" Please come back and try again later.") " Please come back and try again later.")
raise raise


# If we want to use django settings anywhere, we need to set up the required
# environment variables.
setup_environ(settings)

# Configure Celery
import djcelery import djcelery
djcelery.setup_loader() djcelery.setup_loader()


Expand Down
1 change: 1 addition & 0 deletions migrations/01-noop.sql
@@ -0,0 +1 @@
-- Example database migration for schematic. Remove this, if you like.
Empty file added migrations/__init__.py
Empty file.
30 changes: 30 additions & 0 deletions migrations/schematic_settings.py
@@ -0,0 +1,30 @@
import sys
import os

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

# Set up playdoh.
import manage
from django.conf import settings

config = settings.DATABASES['default']
config['HOST'] = config.get('HOST', 'localhost')
config['PORT'] = config.get('PORT', '3306')

if not config['HOST'] or config['HOST'].endswith('.sock'):
"""Oh, you meant 'localhost'!"""
config['HOST'] = 'localhost'

s = 'mysql --silent {NAME} -h{HOST} -u{USER}'

if config['PASSWORD']:
s += ' -p{PASSWORD}'
else:
del config['PASSWORD']
if config['PORT']:
s += ' -P{PORT}'
else:
del config['PORT']

db = s.format(**config)
table = 'schema_version'
2 changes: 1 addition & 1 deletion vendor
Submodule vendor updated 3 files
+3 −0 .gitmodules
+1 −0 src/schematic
+1 −0 vendor.pth

0 comments on commit 5527311

Please sign in to comment.