Fall back to extracting sequence name from column default
What does this MR do and why?
Update Gitlab::Database::Partitioning::ReplaceTable to try extract sequence name from column's default when pg_get_serial_sequence returns null.
References
Numbered steps to set up and validate the change are strongly suggested.
Example:
- Remove ownership for a sequence
ALTER SEQUENCE uploads_id_seq OWNED BY NONE; - On master
> Gitlab::Database::Partitioning::ReplaceTable.new(ApplicationRecord.connection, 'uploads', 'uploads_new', 'uploads_archived', 'id').sequence => nil - On this branch
> Gitlab::Database::Partitioning::ReplaceTable.new(ApplicationRecord.connection, 'uploads', 'uploads_new', 'uploads_archived', 'id').sequence => "uploads_id_seq"
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.