def init_postgresql_fts(apps, schema_editor):
    conn = schema_editor.connection
    if hasattr(conn, 'vendor') and conn.vendor == 'postgresql':
        script_path = os.path.join(askbot.get_install_directory(), 'search',
                                   'postgresql',
                                   'thread_and_post_models_03012016.plsql')
        setup_full_text_search(script_path)
 def forwards(self, orm):
     "Write your forwards methods here."
     if 'postgresql_psycopg2' in askbot.get_database_engine_name():
         script_path = os.path.join(askbot.get_install_directory(),
                                    'search', 'postgresql',
                                    'question_answer_comment_models.plsql')
         setup_full_text_search(script_path)
 def handle_noargs(self, **options):
     script_path = os.path.join(
                         askbot.get_install_directory(),
                         'search',
                         'postgresql',
                         'thread_and_post_models_01162012.plsql'
                     )
     setup_full_text_search(script_path)
Пример #4
0
 def forwards(self, orm):
     "Write your forwards methods here."
     db_engine_name = askbot.get_database_engine_name()
     if 'postgresql_psycopg2' in db_engine_name:
         script_path = os.path.join(
             askbot.get_install_directory(), 'search', 'postgresql',
             'thread_and_post_models_10032013.plsql')
         postgresql.setup_full_text_search(script_path)
 def forwards(self, orm):
     "Write your forwards methods here."
     db_engine_name = askbot.get_database_engine_name()
     if 'postgresql_psycopg2' in db_engine_name:
         script_path = os.path.join(askbot.get_install_directory(),
                                    'search', 'postgresql',
                                    'user_profile_search_16102012.plsql')
         postgresql.setup_full_text_search(script_path)
Пример #6
0
    def handle(self, **options):
        dir_path = askbot.get_install_directory()
        script_path = os.path.join(dir_path, 'search', 'postgresql',
                                   'thread_and_post_models_03012016.plsql')
        setup_full_text_search(script_path)

        script_path = os.path.join(dir_path, 'search', 'postgresql',
                                   'user_profile_search_12202015.plsql')
        setup_full_text_search(script_path)
 def forwards(self, orm):
     "Write your forwards methods here."
     if 'postgresql_psycopg2' in askbot.get_database_engine_name():
         script_path = os.path.join(
                             askbot.get_install_directory(),
                             'search',
                             'postgresql',
                             'thread_and_post_models_01162012.plsql'
                         )
         setup_full_text_search(script_path)
def init_postgresql_fts(apps, schema_editor):
    conn = schema_editor.connection
    if hasattr(conn, 'vendor') and conn.vendor == 'postgresql':
        script_path = os.path.join(
                            askbot.get_install_directory(),
                            'search',
                            'postgresql',
                            'thread_and_post_models_03012016.plsql'
                        )
        setup_full_text_search(script_path)
 def forwards(self, orm):
     "Write your forwards methods here."
     if 'postgresql_psycopg2' in askbot.get_database_engine_name():
         script_path = os.path.join(
                             askbot.get_install_directory(),
                             'search',
                             'postgresql',
                             'exercise_problem_comment_models.plsql'
                         )
         setup_full_text_search(script_path)
Пример #10
0
    def handle_noargs(self, **options):
        script_path = os.path.join(askbot.get_install_directory(), 'search',
                                   'postgresql',
                                   'thread_and_post_models_10032013.plsql')
        setup_full_text_search(script_path)

        script_path = os.path.join(askbot.get_install_directory(), 'search',
                                   'postgresql',
                                   'user_profile_search_12192015.plsql')
        setup_full_text_search(script_path)
 def forwards(self, orm):
     "Write your forwards methods here."
     db_engine_name = askbot.get_database_engine_name()
     if 'postgresql_psycopg2' in db_engine_name:
         script_path = os.path.join(
                             askbot.get_install_directory(),
                             'search',
                             'postgresql',
                             'user_profile_search_02262013.plsql'
                         )
         postgresql.setup_full_text_search(script_path)
Пример #12
0
def init_postgresql_fts(apps, schema_editor):
    conn = schema_editor.connection
    if hasattr(conn, "vendor") and conn.vendor == "postgresql":
        script_path = os.path.join(
            askbot.get_install_directory(), "search", "postgresql", "thread_and_post_models_10032013.plsql"
        )
        setup_full_text_search(script_path)

        script_path = os.path.join(
            askbot.get_install_directory(), "search", "postgresql", "user_profile_search_12202015.plsql"
        )
        setup_full_text_search(script_path)
def init_postgresql_fts(apps, schema_editor):
    conn = schema_editor.connection
    # if conn does not have an attribute vendor, there is probalby something
    # wrong with Django and we should raise an exception, i.e. provoke the
    # AttributeError
    if not hasattr(conn, 'vendor') or conn.vendor != 'postgresql':
        return

    script_path = os.path.join(askbot.get_install_directory(), 'search',
                               'postgresql',
                               'thread_and_post_models_03012016.plsql')
    setup_full_text_search(script_path)
Пример #14
0
def init_postgresql_fts(apps, schema_editor):
    conn = schema_editor.connection
    # if conn does not have an attribute vendor, there is probalby something
    # wrong with Django and we should raise an exception, i.e. provoke the
    # AttributeError
    if not hasattr(conn, 'vendor') or conn.vendor != 'postgresql':
        return

    #there used to be also setup of thread and post model FTS,
    #but now we have a better migration 0009

    script_path = os.path.join(askbot.get_install_directory(), 'search',
                               'postgresql',
                               'user_profile_search_12202015.plsql')
    setup_full_text_search(script_path)
 def forwards(self, orm):
     "Write your forwards methods here."
     # Note: Remember to use orm['appname.ModelName'] rather than "from appname.models..."
     if db.backend_name == 'mysql':
         table_name = orm['askbot.Thread']._meta.db_table
         if mysql_table_supports_full_text_search(table_name):
             columns = ('title', 'tagnames')
             sql = get_create_full_text_index_sql(INDEX_NAME, table_name,
                                                  columns)
             db.execute(sql)
     elif db.backend_name == 'postgres':
         script_path = os.path.join(
             askbot.get_install_directory(), 'search', 'postgresql',
             'thread_and_post_models_27112012.plsql')
         postgresql.setup_full_text_search(script_path)
    def handle_noargs(self, **options):
        script_path = os.path.join(
                            askbot.get_install_directory(),
                            'search',
                            'postgresql',
                            'thread_and_post_models_10032013.plsql'
                        )
        setup_full_text_search(script_path)

        script_path = os.path.join(
                            askbot.get_install_directory(),
                            'search',
                            'postgresql',
                            'user_profile_search_12192015.plsql'
                        )
        setup_full_text_search(script_path)
 def forwards(self, orm):
     "Write your forwards methods here."
     # Note: Remember to use orm['appname.ModelName'] rather than "from appname.models..."
     if db.backend_name == 'mysql':
         table_name = orm['askbot.Thread']._meta.db_table
         if mysql_table_supports_full_text_search(table_name):
             columns = ('title', 'tagnames')
             sql = get_create_full_text_index_sql(INDEX_NAME, table_name, columns)
             db.execute(sql)
     elif db.backend_name == 'postgres':
         script_path = os.path.join(
                             askbot.get_install_directory(),
                             'search',
                             'postgresql',
                             'thread_and_post_models_27112012.plsql'
                         )
         postgresql.setup_full_text_search(script_path)
    def forwards(self, orm):
        "Write your forwards methods here."
        profiles = orm['askbot.GroupProfile'].objects.all()
        items = profiles.iterator()
        count = profiles.count()
        message = 'Transfering group information from Tag to Group model'
        for profile in ProgressBar(items, count, message):
            group_tag = profile.group_tag
            group_name = group_tag.name.replace('-', ' ')
            group = orm['askbot.Group']()
            group.name = group_name
            group.logo_url = profile.logo_url
            group.moderate_email = profile.moderate_email
            group.is_open = profile.is_open
            group.preapproved_emails = profile.preapproved_emails
            group.preapproved_email_domains = profile.preapproved_email_domains

            try:
                #see if such group is already there
                auth_group = orm['auth.Group'].objects.get(name=group_name)
                group.group_ptr = auth_group
            except orm['auth.Group'].DoesNotExist:
                pass

            group.save()

            #update thread groups
            thread_groups = orm['askbot.ThreadToGroup'].objects
            thread_groups = thread_groups.filter(tag=group_tag)
            thread_groups.update(group=group)
            #update post groups
            post_groups = orm['askbot.PostToGroup'].objects
            post_groups = post_groups.filter(tag=group_tag)
            post_groups.update(group=group)
            #update user groups
            memberships = group_tag.user_memberships.all()
            for membership in memberships:
                membership.user.groups.add(group)

        db_engine_name = askbot.get_database_engine_name()
        if 'postgresql_psycopg2' in db_engine_name:
            from django.db import connection
            cursor = connection.cursor()
            cursor.execute(
                'DROP TRIGGER IF EXISTS group_membership_tsv_update_trigger '
                'ON askbot_groupmembership'
            )

        message = 'Deleting old group information'
        items = profiles.iterator()
        for profile in ProgressBar(items, count, message):
            group_tag = profile.group_tag
            group_tag.user_memberships.all().delete()
            profile.delete()

        #for postgresql setup new user full text search
        if 'postgresql_psycopg2' in db_engine_name:
            
            script_path = os.path.join(
                askbot.get_install_directory(),
                'search', 'postgresql', 
                'user_profile_search_08312012.plsql'
            )
            setup_full_text_search(script_path)
Пример #19
0
    def forwards(self, orm):
        "Write your forwards methods here."
        profiles = orm['askbot.GroupProfile'].objects.all()
        items = profiles.iterator()
        count = profiles.count()
        message = 'Transfering group information from Tag to Group model'
        for profile in ProgressBar(items, count, message):
            group_tag = profile.group_tag
            group_name = group_tag.name.replace('-', ' ')
            group = orm['askbot.Group']()
            group.name = group_name
            group.logo_url = profile.logo_url
            group.moderate_email = profile.moderate_email
            group.is_open = profile.is_open
            group.preapproved_emails = profile.preapproved_emails
            group.preapproved_email_domains = profile.preapproved_email_domains

            try:
                #see if such group is already there
                auth_group = orm['auth.Group'].objects.get(name=group_name)
                group.group_ptr = auth_group
            except orm['auth.Group'].DoesNotExist:
                pass

            group.save()

            #update thread groups
            thread_groups = orm['askbot.ThreadToGroup'].objects
            thread_groups = thread_groups.filter(tag=group_tag)
            thread_groups.update(group=group)
            #update post groups
            post_groups = orm['askbot.PostToGroup'].objects
            post_groups = post_groups.filter(tag=group_tag)
            post_groups.update(group=group)
            #update user groups
            memberships = group_tag.user_memberships.all()
            for membership in memberships:
                membership.user.groups.add(group)

        db_engine_name = askbot.get_database_engine_name()
        if 'postgresql_psycopg2' in db_engine_name:
            from django.db import connection
            cursor = connection.cursor()
            cursor.execute(
                'DROP TRIGGER IF EXISTS group_membership_tsv_update_trigger '
                'ON askbot_groupmembership'
            )

        message = 'Deleting old group information'
        items = profiles.iterator()
        for profile in ProgressBar(items, count, message):
            group_tag = profile.group_tag
            group_tag.user_memberships.all().delete()
            profile.delete()

        #for postgresql setup new user full text search
        if 'postgresql_psycopg2' in db_engine_name:
            
            script_path = os.path.join(
                askbot.get_install_directory(),
                'search', 'postgresql', 
                'user_profile_search_08312012.plsql'
            )
            setup_full_text_search(script_path)