django-fluent/django-fluent-comments

The `migrate_comments` command when adding threaded comments is giving an error.

hexstr1p opened this issue · 1 comments

When trying to add django-threadedcomments, the documentation states to do this:

INSTALLED_APPS += (
    'threadedcomments',
)

COMMENTS_APP = 'fluent_comments'

and then run

./manage.py migrate
./manage.py migrate_comments

but when ./manage.py migrate_comments is run it gives this error:

Traceback (most recent call last):
  File "/Users/jeanne/Env/phobeus_env/lib/python3.7/site-packages/django/db/backends/utils.py", line 83, in _execute
    return self.cursor.execute(sql)
  File "/Users/jeanne/Env/phobeus_env/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py", line 296, in execute
    return Database.Cursor.execute(self, query)
sqlite3.OperationalError: no such function: TO_CHAR

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "./manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/jeanne/Env/phobeus_env/lib/python3.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/Users/jeanne/Env/phobeus_env/lib/python3.7/site-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/jeanne/Env/phobeus_env/lib/python3.7/site-packages/django/core/management/base.py", line 316, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/Users/jeanne/Env/phobeus_env/lib/python3.7/site-packages/django/core/management/base.py", line 353, in execute
    output = self.handle(*args, **options)
  File "/Users/jeanne/Env/phobeus_env/lib/python3.7/site-packages/threadedcomments/management/commands/migrate_comments.py", line 33, in handle
    cursor.execute(SQL)
  File "/Users/jeanne/Env/phobeus_env/lib/python3.7/site-packages/django/db/backends/utils.py", line 100, in execute
    return super().execute(sql, params)
  File "/Users/jeanne/Env/phobeus_env/lib/python3.7/site-packages/django/db/backends/utils.py", line 68, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/Users/jeanne/Env/phobeus_env/lib/python3.7/site-packages/django/db/backends/utils.py", line 77, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/Users/jeanne/Env/phobeus_env/lib/python3.7/site-packages/django/db/backends/utils.py", line 85, in _execute
    return self.cursor.execute(sql, params)
  File "/Users/jeanne/Env/phobeus_env/lib/python3.7/site-packages/django/db/utils.py", line 89, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/Users/jeanne/Env/phobeus_env/lib/python3.7/site-packages/django/db/backends/utils.py", line 83, in _execute
    return self.cursor.execute(sql)
  File "/Users/jeanne/Env/phobeus_env/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py", line 296, in execute
    return Database.Cursor.execute(self, query)
django.db.utils.OperationalError: no such function: TO_CHAR

Hmm it looks like sqlite isn't supported by the threadedcomments migration.

You only need this when there are existing comments in the database, otherwise, you can skip that command.