drawdb-io / drawdb-io/drawdb

[BUG] Not Correctly Altering Tables For FKs

Open
#749 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
39.5k
Forks
3.2k
Avg merge
10h 46m
Merged PRs (30d)
16

Description

**Describe the bug**
The Junction Table should have the Many of the Many-to-One. The screen shot shows the Manys (n) around the junction table. But when I export, 14 of the 16 had the Many's on the opposite side.

**To Reproduce**
Steps to reproduce the behavior:
1. Started off with Blank slate
2. Added Junction Tables and Regular Tables
3. The dragged primary key of Regular Tables To Field that will function as foreign key. (And Vice Versa). Usually the relationship was one to one but fixed to many on the junction table via the references tab.
4. AI helped me figure out why i couldn't import that which i just exported.

**Expected behavior**
FK schema should update

**Screenshots**

[BeforeFKFix.sql](https://github.com/user-attachments/files/23830945/BeforeFKFix.sql)
[ForeignKeyTossUp.sql](https://github.com/user-attachments/files/23830944/ForeignKeyTossUp.sql)
Image

**Desktop (please complete the following information):**
- OS: Windows 11 Pro Windows Feature Experience Pack 1000.26100.265.0
- Browser Edge Version 142.0.3595.53 (Official build) (64-bit)

**Additional context**
Add any other context about the problem here. If the bug involves the import feature, please, attach the imported file.

Contributor guide

Open the contributing guide

Research direction

Start by importing or reproducing the schema in BeforeFKFix.sql and ForeignKeyTossUp.sql, then compare the diagram's foreign-key cardinalities with the exported SQL. Trace the junction-table relationship and export/import flow; done means junction tables retain the many-side relationships and the resulting schema imports consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, sql
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.