[ticket/naderman/9725] Move primary key creation to the correct location

PHPBB3-9725
[ticket/naderman/9725] Do not use deprecated views to remove default constraints

PHPBB3-9725