# How I Migrated a Live Database to a Many-to-Many Relationship

DevFeed: [How I Migrated a Live Database to a Many-to-Many Relationship](<https://devfeed.tech/articles/how-i-migrated-a-live-database-to-a-many-to-many-relationship-97407.md>)

Original publisher: [Read original article](<https://hackernoon.com/how-i-migrated-a-live-database-to-a-many-to-many-relationship?source=rss>)

Author: Gabriela Colombo Alves Longo

Published: 2026-10-23T08:53:36Z

Content type: tutorial

Language: en

Sources: [HackerNoon](<https://devfeed.tech/sources/hackernoon.md>)

Topics: [schema-evolution](<https://devfeed.tech/topics/schema-evolution.md>), [expand and contract migration](<https://devfeed.tech/topics/expand-and-contract-migration.md>), [Database](<https://devfeed.tech/topics/database.md>), [Data Quality](<https://devfeed.tech/topics/data-quality.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [app](<https://devfeed.tech/tags/app.md>), [backend](<https://devfeed.tech/tags/backend.md>), [backward-compatible-apis](<https://devfeed.tech/tags/backward-compatible-apis.md>), [clients](<https://devfeed.tech/tags/clients.md>), [compatibility](<https://devfeed.tech/tags/compatibility.md>), [dashboard](<https://devfeed.tech/tags/dashboard.md>), [data](<https://devfeed.tech/tags/data.md>), [database](<https://devfeed.tech/tags/database.md>), [database-backfill](<https://devfeed.tech/tags/database-backfill.md>), [database-schema](<https://devfeed.tech/tags/database-schema.md>), [database-schema-migration](<https://devfeed.tech/tags/database-schema-migration.md>), [event-platform](<https://devfeed.tech/tags/event-platform.md>), [expand-and-contract-migration](<https://devfeed.tech/tags/expand-and-contract-migration.md>), [graphql](<https://devfeed.tech/tags/graphql.md>), [graphql-api-compatibility](<https://devfeed.tech/tags/graphql-api-compatibility.md>), [index](<https://devfeed.tech/tags/index.md>), [integrations](<https://devfeed.tech/tags/integrations.md>), [many-to-many](<https://devfeed.tech/tags/many-to-many.md>), [many-to-many-relationships](<https://devfeed.tech/tags/many-to-many-relationships.md>), [system-design](<https://devfeed.tech/tags/system-design.md>)

## AI overview

The article describes evolving a live speaker-role feature from one-to-one to many-to-many while keeping existing events and clients working. Version 1 created a default role for every event, migrated existing speakers to it, and made GraphQL `roleId` optional so older clients received the default. Because existing free-text speaker types were sparse and inconsistent, the author used an organizer toggle instead of automatically converting them. For Version 2, a pivot table was added alongside the old foreign key; writes moved to the new table, existing links were backfilled, and reads preferred the pivot table with fallback to the old relationship. This let deployment and backfill proceed without a gap in role data or an API response shape change. The account emphasizes checking data quality and involving teams close to customers when choosing relationship cardinality.

## Source excerpt

How I shipped a feature as a 1:1 relationship, then redesigned it to many-to-many after release, without breaking existing events or clients.