split partition.sql into table and function parts

Makes it easier to patch partition functions on an already existing
database.