
# insert into your DB
cat test_case.sql | sqlite3 test.db
cat test_case.mysql.sql | mysql -u test test
cat test_case.psql.sql | psql -U test test

## the command for postgresql will fail, as '0000-00-00' is not a valid
## data in postgresql.. As such the rest of this testcase is not applicable.

# create app for legacy tables
./manage.py startapp testcase

# run inspectdb
./manage.py inspectdb > testcase/models.py

# modify models.py (set primary key for instance)
$EDITOR testcase/models.py

# run syncdb
./manage.py syncdb

# run dumpdata
./manage.py dumpdata testcase

## For sqlite3 this yields:
  File "/usr/lib/python2.4/site-packages/django/db/backends/util.py", line 49, in typecast_date
    return s and datetime.date(*map(int, s.split('-'))) or None # returns None if s is null
ValueError: year is out of range

# cannot run loaddata for sqlite3 as it failed saving the fixture.
# datetime cannot use '0000' as a year field.

## For mysql this yields:
...
    {
        "pk": 2,
        "model": "testcase.testcase",
        "fields": {
            "date": null,
            "header": "test case 2"
        }
    },
...

# run loaddata
./manage.py loaddata test_dump.json
Installing json fixture 'xxx' from absolute path.
Problem installing fixture 'xxx.json': Column 'Date' cannot be null

## For postgresql this yields:
Error: Unable to serialize database: year=1 is before 1900; the datetime strftime() methods require year >= 1900

