On Postgres 11 and later a nullable column with a default is a metadata-only change. Adding NOT NULL afterwards is the part that needs care.
Tag
Snippets tagged migrations
Copying rows with explicit ids leaves the identity sequence behind, so the next insert collides with an existing row.