Skip to content

[BUG] Importing DBML files doesn't preserve Ref keys(names) #1033

Description

@jamhour1g

Describe the bug
I'm trying to import a DBML file where the refs are as follows:

Table users [headercolor: #175e7a] {
	id uuid [pk, default: `uuidv7()`]
}

Table user_sessions [headercolor: #175e7a] {
	id uuid [pk, default: `uuidv7()`]
	user_id uuid [not null]
}

Table addresses [headercolor: #175e7a] {
	id uuid [pk, default: `uuidv7()`]
	user_id uuid [not null]
}

Ref user_has_many_sessions {
	user_sessions.user_id > users.id [delete: cascade, update: no action]
}

Ref user_has_many_addresses {
	addresses.user_id > users.id [delete: cascade, update: no action]
}

or this:

Table users [headercolor: #175e7a] {
	id uuid [pk, default: `uuidv7()`]
}

Table user_sessions [headercolor: #175e7a] {
	id uuid [pk, default: `uuidv7()`]
	user_id uuid [not null]
}

Table addresses [headercolor: #175e7a] {
	id uuid [pk, default: `uuidv7()`]
	user_id uuid [not null]
}

Ref "user has many sessions" {
	user_sessions.user_id > users.id [delete: cascade, update: no action]
}

Ref "user has many addresses" {
	addresses.user_id > users.id [delete: cascade, update: no action]
}

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'File'
  2. Click on 'Import from'
  3. Select 'DBML'
  4. Select the file

Expected behavior
I expect the tables to be drawn and the relationships name(key) to be persevered not overwritten with the default format of "fk_$foreignTableName_$foreignTableColumnName_$PrimaryTableName"

Screenshots

Image

Desktop (please complete the following information):

  • OS:
Edition	Windows 11 Pro
Version	25H2
OS build	26200.8457
Experience	Windows Feature Experience Pack 1000.26100.304.0
  • Browser Microsoft Edge Version 149.0.4022.52 (Official build) (64-bit)

Additional context
Here's the same markdown present in the issue above as files for the lazy ones

tests.zip

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions