Conversation
|
I didn't add an importer and only a simple test, but this worked for my usecase |
nguyenalter
left a comment
There was a problem hiding this comment.
Please implement the code to export many-to-many relationships in DBML.
You can implement it similar to this function:
| break; | ||
|
|
||
| case 'sqlite': | ||
| res = SqliteExporter.export(normalizedModel); |
There was a problem hiding this comment.
It would be best if you could use the same class name SQLiteExporter as the class definition to make it easy to debug in the future.
| static exportRefs (refIds, model, usedTableNames) { | ||
| return []; | ||
| } |
There was a problem hiding this comment.
I found that SQLite does not support the ALTER TABLE ... ADD FOREIGN KEY ... syntax (see: https://www.sqlite.org/omitted.html).
I believe that we can move the relationship definitions in the CREATE TABLE ... statement.
| Table "order_items" { | ||
| "order_id" integer | ||
| "product_id" integer | ||
| "quantity" integer [default: 1] | ||
| } |
There was a problem hiding this comment.
Although the DBML syntax is correct, this mapping table should be defined after the products table so that when we export to SQLite, if the foreign key constraints are added in the CREATE TABLE "ORDER_ITEMS" ... statement, the exported SQL is still correct.
| static exportIndexes (indexIds, model) { | ||
| return []; | ||
| } |
There was a problem hiding this comment.
Please export the indexes.
| static getTableContentArr (tableIds, model) { | ||
| const tableContentArr = tableIds.map((tableId) => { | ||
| const fieldContents = SQLiteExporter.getFieldLines(tableId, model); |
There was a problem hiding this comment.
This function needs to export the composite primary keys. You can refer to
to implement it|
Any updates for this? |
|
Ping |
|
Hey @nguyenalter I'm picking this up — just checking in to see if you're still around to review and merge when done. |
|
@galvez Thank you for your help. Feel free to create another PR. We will be there to review it when everything is ready. |
|
any update on this? sqlite3 support will be a great feature! |
|
Would also love to know if there is anyone working on this. |
Summary
Issue
#14
#286
Lasting Changes (Technical)
Checklist
Please check directly on the box once each of these are done