ALTER TABLE IF EXISTS api.records_segments DROP COLUMN segments_order; ALTER TABLE IF EXISTS api.records_segments ADD COLUMN segment_order INT NOT NULL DEFAULT 0;