Ask Your Question
0

fail to migrate using MySQL

asked 2013-04-15 09:18:51 -0500

jqy3222089 gravatar image

I try to install ASKBOT with MySQL "python manage.py sync -all" works fine, but when run "python manage.py migrate --all", seems every migration occured an error "Migration 'askbot:0001_initial' is marked for no-dry-run"

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
2

answered 2013-04-15 13:56:05 -0500

Evgeny gravatar image

updated 2013-04-19 01:47:48 -0500

edit I believe these issues were fixed now - please check new code from the repository.

With the python manage.py syncdb --all use command python manage.py migrate --fake and you should avoid these issues. Is there specific reason why you cannot use Postgresql?

syncdb --all is a version of syncdb command that is provided by the Django South app. The --all option will force creation of all tables to the spec provided by the models module. migrate --fake will mark all database migrations as applied without actually running any migration code.

edit flag offensive delete link more

Comments

That worked! What do these two commands mean? using MySQL is for the chinese fulltext search, and Postgresql can support this kind of feature?

jqy3222089 gravatar imagejqy3222089 ( 2013-04-15 18:36:56 -0500 )edit

I understand, Postgres does not support full text search. Do you have a working script for the Chinese search, could you share it? I'll work on restoring the proper MySQL support.

Evgeny gravatar imageEvgeny ( 2013-04-15 18:58:19 -0500 )edit

@Evgeny So if i run "python manage.py syncdb --all", the data stored in the datebase would all be gone?

jqy3222089 gravatar imagejqy3222089 ( 2013-04-16 09:42:11 -0500 )edit

@jqy3222089 I tink we've fixed these issues in the migrations.

Evgeny gravatar imageEvgeny ( 2013-04-20 22:07:28 -0500 )edit

@Evgeny Hi, I have checked the new code, still can't work correctly with "python manage.py migrate --all", same error message. BTW I used the MySQL 5.6.

jqy3222089 gravatar imagejqy3222089 ( 2013-04-22 07:26:05 -0500 )edit
0

answered 2013-04-16 07:39:49 -0500

jqy3222089 gravatar image

#if you have many posts, it's best to configure another index for new posts and #periodically merge the diff index to the main #this is not important until you get to hundreds of thousands posts

source src_askbot { # data source type = mysql sql_host = localhost sql_user = {{ db_user }} #replace with your db username sql_pass = {{ db_password }} #replace with your db password sql_db = {{ db_name }} #replace with your db name # these two are optional #sql_port = 3306 #sql_sock = /var/lib/mysql/mysql.sock

# pre-query, executed before the main fetch query
sql_query_pre   = SET NAMES utf8

# main document fetch query - change the table names if you are using a prefix
# this query creates a flat document from each question that includes only latest
# revisions of the question and all of it's answers
sql_query       =       SELECT q.id as id, t.title AS title, t.tagnames as tags, qr.text AS text, answers_combined.text AS answers \
                        FROM askbot_post AS q \
                        INNER JOIN askbot_thread as t \
                        ON t.id=q.thread_id \
                        INNER JOIN \
                        ( \
                            SELECT MAX(id) as id, post_id \
                            FROM askbot_postrevision \
                            GROUP BY post_id \
                        ) \
                        AS mqr \
                        ON q.id=mqr.post_id \
                        INNER JOIN askbot_postrevision AS qr ON qr.id=mqr.id \
                        LEFT JOIN \
                        ( \
                            SELECT GROUP_CONCAT(answer_current.text SEPARATOR '. ') AS text, \
                                   thread_id \
                            FROM \
                            ( \
                                SELECT a.thread_id, a.text as text \
                                FROM askbot_post AS a \
                                WHERE a.deleted=0 and (a.post_type='answer' or a.post_type='comment') \
                            ) \
                            AS answer_current \
                            GROUP BY thread_id \
                        ) \
                        AS answers_combined ON q.id=answers_combined.thread_id \
                        WHERE q.deleted=0;

# optional - used by command-line search utility to display document information
sql_query_info  = SELECT title, id FROM question WHERE id=$id

}

index askbot { # which document source to index source = src_askbot

# this is path and index file name without extension
# you may need to change this path or create this folder
path        = /var/data/sphinx/askbot_main

# docinfo (ie. per-document attribute values) storage strategy
docinfo     = extern

# morphology
morphology  = stem_en

# stopwords file
#stopwords  = /var/data/sphinx/stopwords.txt

# minimum word length
min_word_len    = 1

# uncomment next 2 lines to allow wildcard (*) searches
#min_infix_len = 1
#enable_star = 1

# charset encoding type
charset_type    = utf-8

chinese_dictionary = /usr/local/sphinx-for-chinese/etc/xdict

}

indexer settings

indexer { # memory limit (default is 32M) mem_limit = 64M }

searchd settings

searchd { # IP address on which search daemon will bind and accept # optional, default is to listen on all addresses, # ie. address = 0.0.0.0 address = 127.0.0.1

# port on which search daemon will listen
port        = 3312

# searchd run info is logged here - create or change the folder
log     = /var/log/sphinx/searchd.log

# all the search queries are logged here
query_log   = /var/log/sphinx/query.log

# client read timeout, seconds
read_timeout    = 5

# maximum amount of children to fork
max_children    = 30

# a file which will contain searchd process ID
pid_file    = /var/log/sphinx/searchd.pid

# maximum amount of matches this daemon would ever retrieve
# from each index and serve to client
max_matches = 1000

}

Blockquote

edit flag offensive delete link more

Comments

@Evgeny this is my sphinx.conf, it worked but i dont know whether it worked correctly. I can use this sphinx.conf to search chinese term in the post. However, when i tried to input more than one keyword, it seems not get the right result.

jqy3222089 gravatar imagejqy3222089 ( 2013-04-16 07:43:18 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-04-15 09:18:51 -0500

Seen: 288 times

Last updated: Apr 19 '13