Sqlite preserves primary keys when copying/altering tables.

Backport #2312.
Fixes #9367.

I also added a test-case to make sure that renaming or removing a column preserves the primary key. While the backport already included a test for the sqlite adapter I wanted to make sure that we cover the new issue from #9367. Also the added test is not adapter specific so we can lock the behavior for all adapters.

I would also like to submit another PR containing only the test-case to the master branch. While the issue is already fixed there I think we should add the new test-case.