RoverBase

How to Add a Foreign Key

  1. Click Add Constraint +
  2. Select Add Foreign Key
  3. Select the target table
  4. Map local column(s) to referenced column(s)
  5. (Optional) Configure additional options
  6. SQL statement for creating Index is generated automatically

Target Table

Select the table that contains the referenced column(s). Must have a primary key or unique constraint

Columns

Define the relationship between columns.

  • Select local column(s)
  • Map them to referenced column(s) in the target table
  • Single column - simple foreign key
  • Multiple columns - composite foreign key (order must match)

On Delete

Defines what happens when a referenced row is deleted. Supported options may vary by database.

On Update

Defines what happens when referenced values are updated. Supported options may vary by database.

Options

Deferrable

Allows the constraint to be checked at transaction end instead of immediately. Supported only in some databases (e.g., PostgreSQL)

Initially Deferred

Only available if Deferrable is enabled. Constraint is checked at commit time by default. Supported only in some databases (e.g., PostgreSQL)

Ready to try RoverBase?

Native performance. Clean UI.

RoverBase
Fast, native database GUI for modern workflows

Product