Changeset - 951248761e43
[Under review]
default
0 2 0
Søren Løvborg (kwi) - 9 years ago 2016-05-18 12:41:24
sorenl@unity3d.com
Preceded by: cdb9dd688f11, ec8500b42712
[WIP] db: ensure consistent key/index/constraint naming

This simplifies future Alembic upgrades/downgrades.
https://alembic.readthedocs.io/en/latest/naming.html

(This has not been tested!)

TBD: How to handle databases created before this.
2 files changed with 9 insertions and 1 deletions:
5 comments (3 inline, 2 general) First comment
kallithea/model/__init__.py
Show inline comments
 
@@ -63,6 +63,14 @@ def init_model(engine):
 
    log.info("initializing db for %s", engine_str)
 
    meta.Base.metadata.bind = engine
 

	
 
    meta.Base.metadata.naming_convention = {
 
      'ix': 'ix_%(column_0_label)s',
 
      'uq': 'uq_%(table_name)s_%(column_0_name)s',
 
      'ck': 'ck_%(table_name)s_%(constraint_name)s',
 
      'fk': 'fk_%(table_name)s_%(column_0_name)s_%(referred_table_name)s',
 
      'pk': 'pk_%(table_name)s'
Thomas De Schampheleire (patrickdp) 9 years ago on this changeset
would be nice to clarify the meaning of these acronyms.
Add Another Comment
 
    }
 

	
 

	
 
class BaseModel(object):
 
    """
setup.py
Show inline comments
 
@@ -43,7 +43,7 @@ requirements = [
 
    "Beaker==1.6.4",
 
    "WebHelpers==1.3",
 
    "formencode>=1.2.4,<=1.2.6",
 
    "SQLAlchemy==0.7.10",
 
    "SQLAlchemy==1.0.13",
Mads Kiilerich (kiilerix) 9 years ago on this changeset
Does it require this specific revision or is any 1.0 known to work?
Søren Løvborg (kwi) 9 years ago on this changeset
Should work in 0.9+, I just pinned because we pinned previously...
Add Another Comment
 
    "Mako>=0.9.0,<=1.0.0",
 
    "pygments>=1.5",
 
    "whoosh>=2.4.0,<=2.5.7",
5 comments (3 inline, 2 general) First comment
Søren Løvborg (kwi) 9 years ago comment on pull request "Move to Alembic for database migrations (v2)"

Status change: Under review

Mads Kiilerich (kiilerix) 9 years ago on this changeset
I guess this doesn't "ensure consistent" - it is only about "create consistent across all databases".

And yeah, the "ensure" step is hard ... but important.
You need to be logged in to comment. Login now