#!/bin/sh
cat $1 | \
    grep -v ^# | \
    grep -v ' KEY "' | \
    grep -v ' UNIQUE KEY "' | \
    sed -e "s/\`/\'/g" -e "s/UNIX_TIMESTAMP()/strftime('%s','now')/" | \
    sed 's/ unsigned / /g' | \
    sed 's/ auto_increment/ /gi' | \
    sed 's/ smallint([0-9]*) / integer /gi' | \
    sed 's/ mediumint([0-9]*) / integer /gi' | \
    sed 's/ tinyint([0-9]*) / integer /gi' | \
    sed 's/ int([0-9]*) / integer /gi' | \
    sed 's/ character set [^ ]* / /gi' | \
    sed 's/ collate [^ ]* / /gi' | \
    sed 's/ enum([^)]*) / varchar(255) /gi' | \
    sed 's/ on update [^,]*//gi'
