Skip to content

Commit

Permalink
[1781] add migration and tables
Browse files Browse the repository at this point in the history
  • Loading branch information
kindly committed Feb 13, 2012
1 parent 50f0946 commit c99ff1b
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
20 changes: 20 additions & 0 deletions ckan/migration/versions/049_term_translation_table.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from sqlalchemy import *
from migrate import *

def upgrade(migrate_engine):
migrate_engine.execute('''
CREATE TABLE term_translation (
term text NOT NULL,
term_translation text NOT NULL,
lang_code text NOT NULL
);
create index term_lang on term_translation(term, lang_code);
create index term on term_translation(term);
'''
)





1 change: 1 addition & 0 deletions ckan/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from package_relationship import *
from task_status import *
from activity import *
from term_translation import *
import ckan.migration
from ckan.lib.helpers import OrderedDict, datetime_to_date_str
from vdm.sqlalchemy.base import SQLAlchemySession
Expand Down
14 changes: 14 additions & 0 deletions ckan/model/term_translation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import sqlalchemy as sa
from meta import *
from core import *
from types import make_uuid
from datetime import datetime

__all__ = ['term_translation_table']

term_translation_table = Table('term_translation', metadata,
Column('term', UnicodeText, nullable=False),
Column('term_translation', UnicodeText, nullable=False),
Column('lang_code', UnicodeText, nullable=False),
)

0 comments on commit c99ff1b

Please sign in to comment.