Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

sqlite and migrations (south) problem #213

Closed
mfa opened this Issue · 9 comments

7 participants

@mfa

File "cms/migrations/0015_modified_by_added.py", line 11, in forwards
db.add_column('cms_publicpage', 'changed_by', orm['cms.publicpage:changed_by'])
File "south/db/sqlite3.py", line 20, in add_column
raise ValueError("You cannot add a null=False column without a default value.")
ValueError: You cannot add a null=False column without a default value.

@digi604
Collaborator

how is the support for sqllite in south nowadays? if you define a default value... does everything else run?

@mfa

I first used sqlite with django-cms-2.0 and had no problems. but without using south.
because of the recent changes I had to use south/migrations. this seems not to work atm with sqlite :(
so this bug is maybe a south-issue, but why does all 14 migrations before work smoothly?
So since yesterday I'm using postgres to run my testsite with django-cms-2.0.

@digi604
Collaborator

could you check with RC3 if this works with sqllite?

@fccoelho

I can confirm that the problem is still there for sqlite with the rc3

@brierwood

I had (what looks to me), like a slightly different manifestation of this problem with the error:

sqlite3.IntegrityError: south_migrationhistory.id may not be NULL

I'm trusting that the person who marked my original as a dup is more in-the-know than I.

Is there a simple workaround that I could use for now? Or is the whole notion of using sqlite with south for local development really not a good idea at this juncture?

@digi604
Collaborator

have a look here for a possible workaround: http://github.com/digi604/django-cms-2.0/issues/#issue/142

@DrMeers

This can be easily fixed:

--- a/cms/migrations/0015_modified_by_added.py
+++ b/cms/migrations/0015_modified_by_added.py
@@ -112,8 +112,8 @@ class Migration:
     'user': ('models.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'})
     },
     'cms.publicpage': {
-            'changed_by': ('models.CharField', [], {'max_length': '70'}),
-            'created_by': ('models.CharField', [], {'max_length': '70'}),
+            'changed_by': ('models.CharField', [], {'max_length': '70', 'default': '""'}),
+            'created_by': ('models.CharField', [], {'max_length': '70', 'default': '""'}),
     'author': ('models.ForeignKey', [], {'to': "orm['auth.User']"}),
     'creation_date': ('models.DateTimeField', [], {'default': 'datetime.datetime(2009, 6, 30, 4, 55, 13, 502271)'
     'id': ('models.AutoField', [], {'primary_key': 'True', 'blank': 'True'}),

However this only gets you a little further down the path...

@cuker

According to the south tutorial you should add a keep_default=False when adding the column:

http://south.aeracode.org/wiki/Tutorial3

I have used south on some rather complex sqlite databases without any issues (this was mainly for testing purposes, in production I use mysql or postgres)

@ojii
Collaborator

3rd party issue, closing

@amarandon amarandon referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.