Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added schematic.

  • Loading branch information...
commit 5527311ed36d1f51c610f3ea53ffc1fc3fc1bea2 1 parent eafc1be
@fwenzel fwenzel authored
View
2  docs/libs.rst
@@ -16,7 +16,7 @@ Database
* `django-multidb-router <https://github.com/jbalogh/django-multidb-router>`_:
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.
Deferred Execution (cron, message queues)
View
5 manage.py
@@ -38,6 +38,11 @@
" Please come back and try again later.")
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
djcelery.setup_loader()
View
1  migrations/01-noop.sql
@@ -0,0 +1 @@
+-- Example database migration for schematic. Remove this, if you like.
View
0  migrations/__init__.py
No changes.
View
30 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  vendor
@@ -1 +1 @@
-Subproject commit 50f7ed7ae3a1980d03ee04f8bb9004e3e69cb8a9
+Subproject commit 8b719f776a3280a9cad439f9def6e238b9843dc3
Please sign in to comment.
Something went wrong with that request. Please try again.