Fix production database (nullable, foreign keys, bigint ids), and make databases more consistent between development, staging and production (#434)