@budibase/server 1.0.80-alpha.1 → 1.0.80-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/builder/assets/{index.c0b657be.js → index.db9b03fd.js} +1 -1
- package/builder/index.html +1 -1
- package/coverage/clover.xml +103 -99
- package/coverage/coverage-final.json +1 -1
- package/coverage/lcov-report/api/controllers/analytics.js.html +1 -1
- package/coverage/lcov-report/api/controllers/apikeys.js.html +1 -1
- package/coverage/lcov-report/api/controllers/application.js.html +1 -1
- package/coverage/lcov-report/api/controllers/auth.js.html +1 -1
- package/coverage/lcov-report/api/controllers/automation.js.html +1 -1
- package/coverage/lcov-report/api/controllers/backup.js.html +1 -1
- package/coverage/lcov-report/api/controllers/cloud.js.html +1 -1
- package/coverage/lcov-report/api/controllers/component.js.html +1 -1
- package/coverage/lcov-report/api/controllers/datasource.js.html +1 -1
- package/coverage/lcov-report/api/controllers/dev.js.html +1 -1
- package/coverage/lcov-report/api/controllers/index.html +1 -1
- package/coverage/lcov-report/api/controllers/integration.js.html +1 -1
- package/coverage/lcov-report/api/controllers/layout.js.html +1 -1
- package/coverage/lcov-report/api/controllers/metadata.js.html +1 -1
- package/coverage/lcov-report/api/controllers/migrations.js.html +1 -1
- package/coverage/lcov-report/api/controllers/permission.js.html +1 -1
- package/coverage/lcov-report/api/controllers/query/index.html +1 -1
- package/coverage/lcov-report/api/controllers/query/index.js.html +1 -1
- package/coverage/lcov-report/api/controllers/query/validation.js.html +1 -1
- package/coverage/lcov-report/api/controllers/role.js.html +1 -1
- package/coverage/lcov-report/api/controllers/routing.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/external.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/index.html +1 -1
- package/coverage/lcov-report/api/controllers/row/index.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/internal.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/staticFormula.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/utils.js.html +1 -1
- package/coverage/lcov-report/api/controllers/screen.js.html +1 -1
- package/coverage/lcov-report/api/controllers/script.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/bulkFormula.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/external.js.html +51 -9
- package/coverage/lcov-report/api/controllers/table/index.html +14 -14
- package/coverage/lcov-report/api/controllers/table/index.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/internal.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/utils.js.html +1 -1
- package/coverage/lcov-report/api/controllers/templates.js.html +1 -1
- package/coverage/lcov-report/api/controllers/user.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/exporters.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/index.html +1 -1
- package/coverage/lcov-report/api/controllers/view/index.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/utils.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/viewBuilder.js.html +1 -1
- package/coverage/lcov-report/api/controllers/webhook.js.html +1 -1
- package/coverage/lcov-report/api/index.html +1 -1
- package/coverage/lcov-report/api/index.js.html +1 -1
- package/coverage/lcov-report/api/routes/analytics.js.html +1 -1
- package/coverage/lcov-report/api/routes/apikeys.js.html +1 -1
- package/coverage/lcov-report/api/routes/application.js.html +1 -1
- package/coverage/lcov-report/api/routes/auth.js.html +1 -1
- package/coverage/lcov-report/api/routes/automation.js.html +1 -1
- package/coverage/lcov-report/api/routes/backup.js.html +1 -1
- package/coverage/lcov-report/api/routes/cloud.js.html +1 -1
- package/coverage/lcov-report/api/routes/component.js.html +1 -1
- package/coverage/lcov-report/api/routes/datasource.js.html +1 -1
- package/coverage/lcov-report/api/routes/deploy.js.html +1 -1
- package/coverage/lcov-report/api/routes/dev.js.html +1 -1
- package/coverage/lcov-report/api/routes/index.html +1 -1
- package/coverage/lcov-report/api/routes/index.js.html +1 -1
- package/coverage/lcov-report/api/routes/integration.js.html +1 -1
- package/coverage/lcov-report/api/routes/layout.js.html +1 -1
- package/coverage/lcov-report/api/routes/metadata.js.html +1 -1
- package/coverage/lcov-report/api/routes/migrations.js.html +1 -1
- package/coverage/lcov-report/api/routes/permission.js.html +1 -1
- package/coverage/lcov-report/api/routes/query.js.html +1 -1
- package/coverage/lcov-report/api/routes/role.js.html +1 -1
- package/coverage/lcov-report/api/routes/routing.js.html +1 -1
- package/coverage/lcov-report/api/routes/row.js.html +1 -1
- package/coverage/lcov-report/api/routes/screen.js.html +1 -1
- package/coverage/lcov-report/api/routes/script.js.html +1 -1
- package/coverage/lcov-report/api/routes/static.js.html +1 -1
- package/coverage/lcov-report/api/routes/table.js.html +1 -1
- package/coverage/lcov-report/api/routes/templates.js.html +1 -1
- package/coverage/lcov-report/api/routes/user.js.html +1 -1
- package/coverage/lcov-report/api/routes/utils/index.html +1 -1
- package/coverage/lcov-report/api/routes/utils/validators.js.html +1 -1
- package/coverage/lcov-report/api/routes/view.js.html +1 -1
- package/coverage/lcov-report/api/routes/webhook.js.html +1 -1
- package/coverage/lcov-report/automations/actions.js.html +1 -1
- package/coverage/lcov-report/automations/automationUtils.js.html +1 -1
- package/coverage/lcov-report/automations/bullboard.js.html +1 -1
- package/coverage/lcov-report/automations/index.html +1 -1
- package/coverage/lcov-report/automations/index.js.html +1 -1
- package/coverage/lcov-report/automations/steps/bash.js.html +1 -1
- package/coverage/lcov-report/automations/steps/createRow.js.html +1 -1
- package/coverage/lcov-report/automations/steps/delay.js.html +1 -1
- package/coverage/lcov-report/automations/steps/deleteRow.js.html +1 -1
- package/coverage/lcov-report/automations/steps/discord.js.html +1 -1
- package/coverage/lcov-report/automations/steps/executeQuery.js.html +1 -1
- package/coverage/lcov-report/automations/steps/executeScript.js.html +1 -1
- package/coverage/lcov-report/automations/steps/filter.js.html +1 -1
- package/coverage/lcov-report/automations/steps/index.html +1 -1
- package/coverage/lcov-report/automations/steps/integromat.js.html +1 -1
- package/coverage/lcov-report/automations/steps/outgoingWebhook.js.html +1 -1
- package/coverage/lcov-report/automations/steps/queryRows.js.html +1 -1
- package/coverage/lcov-report/automations/steps/sendSmtpEmail.js.html +1 -1
- package/coverage/lcov-report/automations/steps/serverLog.js.html +1 -1
- package/coverage/lcov-report/automations/steps/slack.js.html +1 -1
- package/coverage/lcov-report/automations/steps/updateRow.js.html +1 -1
- package/coverage/lcov-report/automations/steps/utils.js.html +1 -1
- package/coverage/lcov-report/automations/steps/zapier.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/app.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/cron.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/index.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/index.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowDeleted.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowSaved.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowUpdated.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/webhook.js.html +1 -1
- package/coverage/lcov-report/automations/triggers.js.html +1 -1
- package/coverage/lcov-report/automations/utils.js.html +1 -1
- package/coverage/lcov-report/constants/index.html +1 -1
- package/coverage/lcov-report/constants/index.js.html +1 -1
- package/coverage/lcov-report/constants/layouts.js.html +1 -1
- package/coverage/lcov-report/constants/screens.js.html +1 -1
- package/coverage/lcov-report/db/client.js.html +1 -1
- package/coverage/lcov-report/db/inMemoryView.js.html +1 -1
- package/coverage/lcov-report/db/index.html +1 -1
- package/coverage/lcov-report/db/index.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/LinkController.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/index.html +1 -1
- package/coverage/lcov-report/db/linkedRows/index.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +1 -1
- package/coverage/lcov-report/db/newid.js.html +1 -1
- package/coverage/lcov-report/db/utils.js.html +1 -1
- package/coverage/lcov-report/events/AutomationEmitter.js.html +1 -1
- package/coverage/lcov-report/events/index.html +1 -1
- package/coverage/lcov-report/events/index.js.html +1 -1
- package/coverage/lcov-report/events/utils.js.html +1 -1
- package/coverage/lcov-report/index.html +14 -14
- package/coverage/lcov-report/integrations/tests/TestConfiguration.js.html +1 -1
- package/coverage/lcov-report/integrations/tests/index.html +1 -1
- package/coverage/lcov-report/middleware/appInfo.js.html +1 -1
- package/coverage/lcov-report/middleware/authorized.js.html +1 -1
- package/coverage/lcov-report/middleware/builder.js.html +1 -1
- package/coverage/lcov-report/middleware/currentapp.js.html +1 -1
- package/coverage/lcov-report/middleware/index.html +1 -1
- package/coverage/lcov-report/middleware/joi-validator.js.html +1 -1
- package/coverage/lcov-report/middleware/resourceId.js.html +1 -1
- package/coverage/lcov-report/middleware/selfhost.js.html +1 -1
- package/coverage/lcov-report/middleware/usageQuota.js.html +1 -1
- package/coverage/lcov-report/middleware/utils.js.html +1 -1
- package/coverage/lcov-report/threads/automation.js.html +1 -1
- package/coverage/lcov-report/threads/index.html +1 -1
- package/coverage/lcov-report/threads/index.js.html +1 -1
- package/coverage/lcov-report/threads/query.js.html +1 -1
- package/coverage/lcov-report/threads/utils.js.html +1 -1
- package/coverage/lcov-report/utilities/bcrypt.js.html +1 -1
- package/coverage/lcov-report/utilities/budibaseDir.js.html +1 -1
- package/coverage/lcov-report/utilities/centralPath.js.html +1 -1
- package/coverage/lcov-report/utilities/csvParser.js.html +1 -1
- package/coverage/lcov-report/utilities/global.js.html +1 -1
- package/coverage/lcov-report/utilities/index.html +1 -1
- package/coverage/lcov-report/utilities/index.js.html +1 -1
- package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +1 -1
- package/coverage/lcov-report/utilities/queue/index.html +1 -1
- package/coverage/lcov-report/utilities/routing/index.html +1 -1
- package/coverage/lcov-report/utilities/routing/index.js.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/index.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/index.js.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +1 -1
- package/coverage/lcov-report/utilities/scriptRunner.js.html +1 -1
- package/coverage/lcov-report/utilities/security.js.html +1 -1
- package/coverage/lcov-report/utilities/statusCodes.js.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/index.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/index.js.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/rows.js.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/usageQuoteReset.js.html +1 -1
- package/coverage/lcov-report/utilities/users.js.html +1 -1
- package/coverage/lcov-report/utilities/workerRequests.js.html +1 -1
- package/coverage/lcov.info +169 -162
- package/dist/api/controllers/table/external.js +8 -2
- package/dist/integrations/base/sql.js +16 -1
- package/dist/integrations/base/sqlTable.js +21 -9
- package/dist/integrations/microsoftSqlServer.js +28 -17
- package/dist/integrations/utils.js +32 -15
- package/dist/package.json +4 -4
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/scripts/integrations/mssql/data/setup.sql +18 -1
- package/scripts/integrations/postgres/init.sql +6 -0
- package/specs/generate.js +13 -2
- package/specs/openapi.json +13 -3
- package/specs/openapi.yaml +10 -2
- package/src/api/controllers/table/external.js +16 -2
- package/src/definitions/datasource.ts +7 -0
- package/src/integrations/base/sql.ts +16 -1
- package/src/integrations/base/sqlTable.ts +35 -13
- package/src/integrations/microsoftSqlServer.ts +52 -32
- package/src/integrations/utils.ts +43 -15
package/coverage/lcov.info
CHANGED
|
@@ -3555,19 +3555,19 @@ end_of_record
|
|
|
3555
3555
|
TN:
|
|
3556
3556
|
SF:src/api/controllers/table/external.js
|
|
3557
3557
|
FN:23,makeTableRequest
|
|
3558
|
-
FN:
|
|
3559
|
-
FN:
|
|
3560
|
-
FN:
|
|
3561
|
-
FN:
|
|
3562
|
-
FN:
|
|
3563
|
-
FN:
|
|
3564
|
-
FN:
|
|
3565
|
-
FN:
|
|
3566
|
-
FN:
|
|
3567
|
-
FN:
|
|
3568
|
-
FN:
|
|
3569
|
-
FN:
|
|
3570
|
-
FN:
|
|
3558
|
+
FN:51,cleanupRelationships
|
|
3559
|
+
FN:60,(anonymous_2)
|
|
3560
|
+
FN:80,getDatasourceId
|
|
3561
|
+
FN:90,otherRelationshipType
|
|
3562
|
+
FN:99,generateManyLinkSchema
|
|
3563
|
+
FN:127,generateLinkSchema
|
|
3564
|
+
FN:138,generateRelatedSchema
|
|
3565
|
+
FN:161,isRelationshipSetup
|
|
3566
|
+
FN:165,(anonymous_9)
|
|
3567
|
+
FN:203,(anonymous_10)
|
|
3568
|
+
FN:268,(anonymous_11)
|
|
3569
|
+
FN:282,(anonymous_12)
|
|
3570
|
+
FN:304,(anonymous_13)
|
|
3571
3571
|
FNF:14
|
|
3572
3572
|
FNH:0
|
|
3573
3573
|
FNDA:0,makeTableRequest
|
|
@@ -3592,211 +3592,218 @@ DA:18,40
|
|
|
3592
3592
|
DA:19,40
|
|
3593
3593
|
DA:20,40
|
|
3594
3594
|
DA:21,40
|
|
3595
|
-
DA:
|
|
3596
|
-
DA:41,0
|
|
3595
|
+
DA:31,0
|
|
3597
3596
|
DA:42,0
|
|
3598
|
-
DA:
|
|
3597
|
+
DA:43,0
|
|
3598
|
+
DA:45,0
|
|
3599
|
+
DA:46,0
|
|
3599
3600
|
DA:48,0
|
|
3600
|
-
DA:
|
|
3601
|
-
DA:
|
|
3601
|
+
DA:52,0
|
|
3602
|
+
DA:54,0
|
|
3602
3603
|
DA:55,0
|
|
3603
|
-
DA:56,0
|
|
3604
|
-
DA:58,0
|
|
3605
3604
|
DA:59,0
|
|
3606
3605
|
DA:60,0
|
|
3607
3606
|
DA:62,0
|
|
3608
|
-
DA:
|
|
3607
|
+
DA:63,0
|
|
3608
|
+
DA:64,0
|
|
3609
|
+
DA:66,0
|
|
3609
3610
|
DA:69,0
|
|
3610
|
-
DA:
|
|
3611
|
-
DA:78,0
|
|
3612
|
-
DA:80,0
|
|
3611
|
+
DA:73,0
|
|
3613
3612
|
DA:81,0
|
|
3614
|
-
DA:
|
|
3613
|
+
DA:82,0
|
|
3614
|
+
DA:84,0
|
|
3615
|
+
DA:85,0
|
|
3615
3616
|
DA:87,0
|
|
3616
|
-
DA:
|
|
3617
|
-
DA:
|
|
3618
|
-
DA:
|
|
3619
|
-
DA:97,0
|
|
3620
|
-
DA:98,0
|
|
3617
|
+
DA:91,0
|
|
3618
|
+
DA:92,0
|
|
3619
|
+
DA:94,0
|
|
3621
3620
|
DA:100,0
|
|
3622
|
-
DA:
|
|
3623
|
-
DA:
|
|
3624
|
-
DA:
|
|
3625
|
-
DA:119,0
|
|
3621
|
+
DA:101,0
|
|
3622
|
+
DA:102,0
|
|
3623
|
+
DA:104,0
|
|
3626
3624
|
DA:120,0
|
|
3625
|
+
DA:121,0
|
|
3626
|
+
DA:122,0
|
|
3627
|
+
DA:123,0
|
|
3627
3628
|
DA:124,0
|
|
3628
|
-
DA:125,0
|
|
3629
|
-
DA:127,0
|
|
3630
3629
|
DA:128,0
|
|
3631
3630
|
DA:129,0
|
|
3632
|
-
DA:130,0
|
|
3633
3631
|
DA:131,0
|
|
3634
|
-
DA:
|
|
3635
|
-
DA:
|
|
3636
|
-
DA:
|
|
3632
|
+
DA:132,0
|
|
3633
|
+
DA:133,0
|
|
3634
|
+
DA:134,0
|
|
3635
|
+
DA:135,0
|
|
3637
3636
|
DA:140,0
|
|
3638
|
-
DA:
|
|
3639
|
-
DA:
|
|
3640
|
-
DA:
|
|
3637
|
+
DA:142,0
|
|
3638
|
+
DA:143,0
|
|
3639
|
+
DA:144,0
|
|
3641
3640
|
DA:149,0
|
|
3642
|
-
DA:
|
|
3641
|
+
DA:150,0
|
|
3642
|
+
DA:151,0
|
|
3643
3643
|
DA:153,0
|
|
3644
|
-
DA:
|
|
3644
|
+
DA:156,0
|
|
3645
|
+
DA:157,0
|
|
3645
3646
|
DA:158,0
|
|
3646
|
-
DA:161,40
|
|
3647
3647
|
DA:162,0
|
|
3648
|
-
DA:
|
|
3649
|
-
DA:
|
|
3648
|
+
DA:165,40
|
|
3649
|
+
DA:166,0
|
|
3650
3650
|
DA:167,0
|
|
3651
|
-
DA:
|
|
3651
|
+
DA:169,0
|
|
3652
3652
|
DA:170,0
|
|
3653
|
-
DA:
|
|
3654
|
-
DA:
|
|
3655
|
-
DA:
|
|
3653
|
+
DA:172,0
|
|
3654
|
+
DA:173,0
|
|
3655
|
+
DA:175,0
|
|
3656
3656
|
DA:182,0
|
|
3657
|
-
DA:
|
|
3657
|
+
DA:183,0
|
|
3658
3658
|
DA:186,0
|
|
3659
3659
|
DA:187,0
|
|
3660
|
-
DA:188,0
|
|
3661
3660
|
DA:190,0
|
|
3661
|
+
DA:191,0
|
|
3662
|
+
DA:192,0
|
|
3662
3663
|
DA:193,0
|
|
3663
|
-
DA:194,0
|
|
3664
3664
|
DA:195,0
|
|
3665
|
-
DA:197,0
|
|
3666
3665
|
DA:198,0
|
|
3666
|
+
DA:199,0
|
|
3667
3667
|
DA:200,0
|
|
3668
|
-
DA:201,0
|
|
3669
3668
|
DA:202,0
|
|
3670
3669
|
DA:203,0
|
|
3671
|
-
DA:
|
|
3672
|
-
DA:
|
|
3673
|
-
DA:
|
|
3674
|
-
DA:
|
|
3675
|
-
DA:
|
|
3670
|
+
DA:205,0
|
|
3671
|
+
DA:206,0
|
|
3672
|
+
DA:207,0
|
|
3673
|
+
DA:208,0
|
|
3674
|
+
DA:214,0
|
|
3675
|
+
DA:215,0
|
|
3676
3676
|
DA:217,0
|
|
3677
|
-
DA:
|
|
3678
|
-
DA:
|
|
3679
|
-
DA:
|
|
3680
|
-
DA:227,0
|
|
3677
|
+
DA:218,0
|
|
3678
|
+
DA:221,0
|
|
3679
|
+
DA:222,0
|
|
3681
3680
|
DA:228,0
|
|
3682
|
-
DA:
|
|
3681
|
+
DA:229,0
|
|
3682
|
+
DA:230,0
|
|
3683
3683
|
DA:232,0
|
|
3684
|
-
DA:
|
|
3684
|
+
DA:233,0
|
|
3685
3685
|
DA:236,0
|
|
3686
|
-
DA:
|
|
3686
|
+
DA:237,0
|
|
3687
|
+
DA:240,0
|
|
3687
3688
|
DA:241,0
|
|
3688
3689
|
DA:244,0
|
|
3689
3690
|
DA:246,0
|
|
3690
|
-
DA:
|
|
3691
|
-
DA:
|
|
3692
|
-
DA:
|
|
3693
|
-
DA:
|
|
3694
|
-
DA:256,0
|
|
3695
|
-
DA:257,0
|
|
3696
|
-
DA:262,0
|
|
3691
|
+
DA:249,0
|
|
3692
|
+
DA:258,0
|
|
3693
|
+
DA:259,0
|
|
3694
|
+
DA:260,0
|
|
3697
3695
|
DA:263,0
|
|
3698
|
-
DA:
|
|
3699
|
-
DA:268,
|
|
3696
|
+
DA:267,0
|
|
3697
|
+
DA:268,0
|
|
3700
3698
|
DA:269,0
|
|
3701
|
-
DA:
|
|
3702
|
-
DA:271,0
|
|
3703
|
-
DA:273,0
|
|
3704
|
-
DA:275,0
|
|
3699
|
+
DA:274,0
|
|
3705
3700
|
DA:276,0
|
|
3706
3701
|
DA:277,0
|
|
3707
3702
|
DA:279,0
|
|
3708
|
-
DA:
|
|
3709
|
-
DA:
|
|
3703
|
+
DA:282,40
|
|
3704
|
+
DA:283,0
|
|
3710
3705
|
DA:284,0
|
|
3711
3706
|
DA:285,0
|
|
3712
3707
|
DA:287,0
|
|
3713
|
-
DA:
|
|
3708
|
+
DA:289,0
|
|
3709
|
+
DA:290,0
|
|
3714
3710
|
DA:291,0
|
|
3715
|
-
DA:292,0
|
|
3716
3711
|
DA:293,0
|
|
3717
3712
|
DA:294,0
|
|
3718
3713
|
DA:296,0
|
|
3719
|
-
DA:
|
|
3720
|
-
DA:
|
|
3721
|
-
|
|
3714
|
+
DA:298,0
|
|
3715
|
+
DA:299,0
|
|
3716
|
+
DA:301,0
|
|
3717
|
+
DA:304,40
|
|
3718
|
+
DA:305,0
|
|
3719
|
+
DA:306,0
|
|
3720
|
+
DA:307,0
|
|
3721
|
+
DA:308,0
|
|
3722
|
+
DA:310,0
|
|
3723
|
+
DA:314,0
|
|
3724
|
+
DA:317,0
|
|
3725
|
+
LF:138
|
|
3722
3726
|
LH:11
|
|
3723
3727
|
BRDA:28,0,0,0
|
|
3724
|
-
BRDA:
|
|
3725
|
-
BRDA:
|
|
3726
|
-
BRDA:
|
|
3727
|
-
BRDA:
|
|
3728
|
-
BRDA:
|
|
3728
|
+
BRDA:29,1,0,0
|
|
3729
|
+
BRDA:42,2,0,0
|
|
3730
|
+
BRDA:42,2,1,0
|
|
3731
|
+
BRDA:45,3,0,0
|
|
3732
|
+
BRDA:45,3,1,0
|
|
3729
3733
|
BRDA:51,4,0,0
|
|
3730
|
-
BRDA:51,4,1,0
|
|
3731
3734
|
BRDA:52,5,0,0
|
|
3732
3735
|
BRDA:52,5,1,0
|
|
3733
|
-
BRDA:
|
|
3734
|
-
BRDA:
|
|
3735
|
-
BRDA:
|
|
3736
|
-
BRDA:
|
|
3737
|
-
BRDA:
|
|
3738
|
-
BRDA:
|
|
3739
|
-
BRDA:
|
|
3740
|
-
BRDA:
|
|
3741
|
-
BRDA:
|
|
3742
|
-
BRDA:
|
|
3743
|
-
BRDA:
|
|
3744
|
-
BRDA:
|
|
3745
|
-
BRDA:
|
|
3746
|
-
BRDA:
|
|
3747
|
-
BRDA:
|
|
3748
|
-
BRDA:
|
|
3749
|
-
BRDA:
|
|
3750
|
-
BRDA:
|
|
3751
|
-
BRDA:
|
|
3752
|
-
BRDA:
|
|
3753
|
-
BRDA:
|
|
3754
|
-
BRDA:
|
|
3755
|
-
BRDA:
|
|
3756
|
-
BRDA:
|
|
3757
|
-
BRDA:
|
|
3758
|
-
BRDA:
|
|
3759
|
-
BRDA:
|
|
3760
|
-
BRDA:
|
|
3761
|
-
BRDA:
|
|
3762
|
-
BRDA:
|
|
3763
|
-
BRDA:
|
|
3764
|
-
BRDA:
|
|
3765
|
-
BRDA:
|
|
3766
|
-
BRDA:
|
|
3767
|
-
BRDA:
|
|
3768
|
-
BRDA:
|
|
3769
|
-
BRDA:
|
|
3770
|
-
BRDA:
|
|
3771
|
-
BRDA:
|
|
3772
|
-
BRDA:
|
|
3773
|
-
BRDA:
|
|
3774
|
-
BRDA:
|
|
3775
|
-
BRDA:
|
|
3776
|
-
BRDA:
|
|
3777
|
-
BRDA:
|
|
3778
|
-
BRDA:
|
|
3779
|
-
BRDA:
|
|
3780
|
-
BRDA:
|
|
3781
|
-
BRDA:
|
|
3782
|
-
BRDA:
|
|
3783
|
-
BRDA:
|
|
3784
|
-
BRDA:
|
|
3785
|
-
BRDA:
|
|
3786
|
-
BRDA:
|
|
3787
|
-
BRDA:
|
|
3788
|
-
BRDA:
|
|
3789
|
-
BRDA:
|
|
3790
|
-
BRDA:
|
|
3791
|
-
BRDA:
|
|
3792
|
-
BRDA:
|
|
3793
|
-
BRDA:
|
|
3794
|
-
BRDA:
|
|
3795
|
-
BRDA:
|
|
3796
|
-
BRDA:
|
|
3797
|
-
BRDA:
|
|
3798
|
-
BRDA:
|
|
3799
|
-
|
|
3736
|
+
BRDA:55,6,0,0
|
|
3737
|
+
BRDA:55,6,1,0
|
|
3738
|
+
BRDA:56,7,0,0
|
|
3739
|
+
BRDA:56,7,1,0
|
|
3740
|
+
BRDA:56,7,2,0
|
|
3741
|
+
BRDA:63,8,0,0
|
|
3742
|
+
BRDA:63,8,1,0
|
|
3743
|
+
BRDA:63,9,0,0
|
|
3744
|
+
BRDA:63,9,1,0
|
|
3745
|
+
BRDA:69,10,0,0
|
|
3746
|
+
BRDA:69,10,1,0
|
|
3747
|
+
BRDA:70,11,0,0
|
|
3748
|
+
BRDA:70,11,1,0
|
|
3749
|
+
BRDA:81,12,0,0
|
|
3750
|
+
BRDA:81,12,1,0
|
|
3751
|
+
BRDA:84,13,0,0
|
|
3752
|
+
BRDA:84,13,1,0
|
|
3753
|
+
BRDA:91,14,0,0
|
|
3754
|
+
BRDA:91,14,1,0
|
|
3755
|
+
BRDA:94,15,0,0
|
|
3756
|
+
BRDA:94,15,1,0
|
|
3757
|
+
BRDA:129,16,0,0
|
|
3758
|
+
BRDA:129,16,1,0
|
|
3759
|
+
BRDA:133,17,0,0
|
|
3760
|
+
BRDA:133,17,1,0
|
|
3761
|
+
BRDA:134,18,0,0
|
|
3762
|
+
BRDA:134,18,1,0
|
|
3763
|
+
BRDA:142,19,0,0
|
|
3764
|
+
BRDA:142,19,1,0
|
|
3765
|
+
BRDA:162,20,0,0
|
|
3766
|
+
BRDA:162,20,1,0
|
|
3767
|
+
BRDA:172,21,0,0
|
|
3768
|
+
BRDA:172,21,1,0
|
|
3769
|
+
BRDA:182,22,0,0
|
|
3770
|
+
BRDA:182,22,1,0
|
|
3771
|
+
BRDA:182,23,0,0
|
|
3772
|
+
BRDA:182,23,1,0
|
|
3773
|
+
BRDA:186,24,0,0
|
|
3774
|
+
BRDA:186,24,1,0
|
|
3775
|
+
BRDA:199,25,0,0
|
|
3776
|
+
BRDA:199,25,1,0
|
|
3777
|
+
BRDA:199,26,0,0
|
|
3778
|
+
BRDA:199,26,1,0
|
|
3779
|
+
BRDA:207,27,0,0
|
|
3780
|
+
BRDA:207,27,1,0
|
|
3781
|
+
BRDA:214,28,0,0
|
|
3782
|
+
BRDA:214,28,1,0
|
|
3783
|
+
BRDA:221,29,0,0
|
|
3784
|
+
BRDA:221,29,1,0
|
|
3785
|
+
BRDA:229,30,0,0
|
|
3786
|
+
BRDA:229,30,1,0
|
|
3787
|
+
BRDA:232,31,0,0
|
|
3788
|
+
BRDA:232,31,1,0
|
|
3789
|
+
BRDA:236,32,0,0
|
|
3790
|
+
BRDA:236,32,1,0
|
|
3791
|
+
BRDA:246,33,0,0
|
|
3792
|
+
BRDA:246,33,1,0
|
|
3793
|
+
BRDA:260,34,0,0
|
|
3794
|
+
BRDA:260,34,1,0
|
|
3795
|
+
BRDA:267,35,0,0
|
|
3796
|
+
BRDA:267,35,1,0
|
|
3797
|
+
BRDA:284,36,0,0
|
|
3798
|
+
BRDA:284,36,1,0
|
|
3799
|
+
BRDA:284,37,0,0
|
|
3800
|
+
BRDA:284,37,1,0
|
|
3801
|
+
BRDA:307,38,0,0
|
|
3802
|
+
BRDA:307,38,1,0
|
|
3803
|
+
BRDA:307,39,0,0
|
|
3804
|
+
BRDA:307,39,1,0
|
|
3805
|
+
BRDA:307,39,2,0
|
|
3806
|
+
BRF:79
|
|
3800
3807
|
BRH:0
|
|
3801
3808
|
end_of_record
|
|
3802
3809
|
TN:
|
|
@@ -16,7 +16,7 @@ const { cloneDeep } = require("lodash/fp");
|
|
|
16
16
|
const csvParser = require("../../../utilities/csvParser");
|
|
17
17
|
const { handleRequest } = require("../row/external");
|
|
18
18
|
const { getAppDB } = require("@budibase/backend-core/context");
|
|
19
|
-
function makeTableRequest(datasource, operation, table, tables, oldTable = null) {
|
|
19
|
+
function makeTableRequest(datasource, operation, table, tables, oldTable = null, renamed = null) {
|
|
20
20
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21
21
|
const json = {
|
|
22
22
|
endpoint: {
|
|
@@ -32,6 +32,9 @@ function makeTableRequest(datasource, operation, table, tables, oldTable = null)
|
|
|
32
32
|
if (oldTable) {
|
|
33
33
|
json.meta.table = oldTable;
|
|
34
34
|
}
|
|
35
|
+
if (renamed) {
|
|
36
|
+
json.meta.renamed = renamed;
|
|
37
|
+
}
|
|
35
38
|
return makeExternalQuery(datasource, json);
|
|
36
39
|
});
|
|
37
40
|
}
|
|
@@ -135,6 +138,7 @@ function isRelationshipSetup(column) {
|
|
|
135
138
|
exports.save = function (ctx) {
|
|
136
139
|
return __awaiter(this, void 0, void 0, function* () {
|
|
137
140
|
const table = ctx.request.body;
|
|
141
|
+
const { _rename: renamed } = table;
|
|
138
142
|
// can't do this right now
|
|
139
143
|
delete table.dataImport;
|
|
140
144
|
const datasourceId = getDatasourceId(ctx.request.body);
|
|
@@ -193,7 +197,7 @@ exports.save = function (ctx) {
|
|
|
193
197
|
const operation = oldTable
|
|
194
198
|
? DataSourceOperation.UPDATE_TABLE
|
|
195
199
|
: DataSourceOperation.CREATE_TABLE;
|
|
196
|
-
yield makeTableRequest(datasource, operation, tableToSave, tables, oldTable);
|
|
200
|
+
yield makeTableRequest(datasource, operation, tableToSave, tables, oldTable, renamed);
|
|
197
201
|
// update any extra tables (like foreign keys in other tables)
|
|
198
202
|
for (let extraTable of extraTablesToUpdate) {
|
|
199
203
|
const oldExtraTable = oldTables[extraTable.name];
|
|
@@ -206,6 +210,8 @@ exports.save = function (ctx) {
|
|
|
206
210
|
if (Array.isArray(tableToSave.constrained)) {
|
|
207
211
|
tableToSave.constrained = tableToSave.constrained.filter(constraint => Object.keys(tableToSave.schema).includes(constraint));
|
|
208
212
|
}
|
|
213
|
+
// remove the rename prop
|
|
214
|
+
delete tableToSave._rename;
|
|
209
215
|
// store it into couch now for budibase reference
|
|
210
216
|
datasource.entities[tableToSave.name] = tableToSave;
|
|
211
217
|
yield db.put(datasource);
|
|
@@ -232,6 +232,9 @@ class InternalBuilder {
|
|
|
232
232
|
create(knex, json, opts) {
|
|
233
233
|
const { endpoint, body } = json;
|
|
234
234
|
let query = knex(endpoint.entityId);
|
|
235
|
+
if (endpoint.schema) {
|
|
236
|
+
query = query.withSchema(endpoint.schema);
|
|
237
|
+
}
|
|
235
238
|
const parsedBody = parseBody(body);
|
|
236
239
|
// make sure no null values in body for creation
|
|
237
240
|
for (let [key, value] of Object.entries(parsedBody)) {
|
|
@@ -250,6 +253,9 @@ class InternalBuilder {
|
|
|
250
253
|
bulkCreate(knex, json) {
|
|
251
254
|
const { endpoint, body } = json;
|
|
252
255
|
let query = knex(endpoint.entityId);
|
|
256
|
+
if (endpoint.schema) {
|
|
257
|
+
query = query.withSchema(endpoint.schema);
|
|
258
|
+
}
|
|
253
259
|
if (!Array.isArray(body)) {
|
|
254
260
|
return query;
|
|
255
261
|
}
|
|
@@ -257,7 +263,7 @@ class InternalBuilder {
|
|
|
257
263
|
return query.insert(parsedBody);
|
|
258
264
|
}
|
|
259
265
|
read(knex, json, limit) {
|
|
260
|
-
let { endpoint, resource, filters,
|
|
266
|
+
let { endpoint, resource, filters, paginate, relationships } = json;
|
|
261
267
|
const tableName = endpoint.entityId;
|
|
262
268
|
// select all if not specified
|
|
263
269
|
if (!resource) {
|
|
@@ -285,6 +291,9 @@ class InternalBuilder {
|
|
|
285
291
|
}
|
|
286
292
|
// start building the query
|
|
287
293
|
let query = knex(tableName).limit(foundLimit);
|
|
294
|
+
if (endpoint.schema) {
|
|
295
|
+
query = query.withSchema(endpoint.schema);
|
|
296
|
+
}
|
|
288
297
|
if (foundOffset) {
|
|
289
298
|
query = query.offset(foundOffset);
|
|
290
299
|
}
|
|
@@ -307,6 +316,9 @@ class InternalBuilder {
|
|
|
307
316
|
update(knex, json, opts) {
|
|
308
317
|
const { endpoint, body, filters } = json;
|
|
309
318
|
let query = knex(endpoint.entityId);
|
|
319
|
+
if (endpoint.schema) {
|
|
320
|
+
query = query.withSchema(endpoint.schema);
|
|
321
|
+
}
|
|
310
322
|
const parsedBody = parseBody(body);
|
|
311
323
|
query = this.addFilters(query, filters, { tableName: endpoint.entityId });
|
|
312
324
|
// mysql can't use returning
|
|
@@ -320,6 +332,9 @@ class InternalBuilder {
|
|
|
320
332
|
delete(knex, json, opts) {
|
|
321
333
|
const { endpoint, filters } = json;
|
|
322
334
|
let query = knex(endpoint.entityId);
|
|
335
|
+
if (endpoint.schema) {
|
|
336
|
+
query = query.withSchema(endpoint.schema);
|
|
337
|
+
}
|
|
323
338
|
query = this.addFilters(query, filters, { tableName: endpoint.entityId });
|
|
324
339
|
// mysql can't use returning
|
|
325
340
|
if (opts.disableReturning) {
|
|
@@ -4,7 +4,7 @@ const knex_1 = require("knex");
|
|
|
4
4
|
const datasource_1 = require("../../definitions/datasource");
|
|
5
5
|
const utils_1 = require("../utils");
|
|
6
6
|
const { FieldTypes, RelationshipTypes } = require("../../constants");
|
|
7
|
-
function generateSchema(schema, table, tables, oldTable = null) {
|
|
7
|
+
function generateSchema(schema, table, tables, oldTable = null, renamed) {
|
|
8
8
|
let primaryKey = table && table.primary ? table.primary[0] : null;
|
|
9
9
|
const columns = Object.values(table.schema);
|
|
10
10
|
// all columns in a junction table will be meta
|
|
@@ -22,7 +22,9 @@ function generateSchema(schema, table, tables, oldTable = null) {
|
|
|
22
22
|
for (let [key, column] of Object.entries(table.schema)) {
|
|
23
23
|
// skip things that are already correct
|
|
24
24
|
const oldColumn = oldTable ? oldTable.schema[key] : null;
|
|
25
|
-
if ((oldColumn && oldColumn.type) ||
|
|
25
|
+
if ((oldColumn && oldColumn.type) ||
|
|
26
|
+
(primaryKey === key && !isJunction) ||
|
|
27
|
+
(renamed === null || renamed === void 0 ? void 0 : renamed.updated) === key) {
|
|
26
28
|
continue;
|
|
27
29
|
}
|
|
28
30
|
switch (column.type) {
|
|
@@ -72,12 +74,18 @@ function generateSchema(schema, table, tables, oldTable = null) {
|
|
|
72
74
|
break;
|
|
73
75
|
}
|
|
74
76
|
}
|
|
77
|
+
if (renamed) {
|
|
78
|
+
schema.renameColumn(renamed.old, renamed.updated);
|
|
79
|
+
}
|
|
75
80
|
// need to check if any columns have been deleted
|
|
76
81
|
if (oldTable) {
|
|
77
82
|
const deletedColumns = Object.entries(oldTable.schema)
|
|
78
83
|
.filter(([key, schema]) => schema.type !== FieldTypes.LINK && table.schema[key] == null)
|
|
79
84
|
.map(([key]) => key);
|
|
80
85
|
deletedColumns.forEach(key => {
|
|
86
|
+
if ((renamed === null || renamed === void 0 ? void 0 : renamed.old) === key) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
81
89
|
if (oldTable.constrained && oldTable.constrained.indexOf(key) !== -1) {
|
|
82
90
|
schema.dropForeign(key);
|
|
83
91
|
}
|
|
@@ -87,17 +95,17 @@ function generateSchema(schema, table, tables, oldTable = null) {
|
|
|
87
95
|
return schema;
|
|
88
96
|
}
|
|
89
97
|
function buildCreateTable(knex, table, tables) {
|
|
90
|
-
return knex.
|
|
98
|
+
return knex.createTable(table.name, schema => {
|
|
91
99
|
generateSchema(schema, table, tables);
|
|
92
100
|
});
|
|
93
101
|
}
|
|
94
|
-
function buildUpdateTable(knex, table, tables, oldTable) {
|
|
95
|
-
return knex.
|
|
96
|
-
generateSchema(schema, table, tables, oldTable);
|
|
102
|
+
function buildUpdateTable(knex, table, tables, oldTable, renamed) {
|
|
103
|
+
return knex.alterTable(table.name, schema => {
|
|
104
|
+
generateSchema(schema, table, tables, oldTable, renamed);
|
|
97
105
|
});
|
|
98
106
|
}
|
|
99
107
|
function buildDeleteTable(knex, table) {
|
|
100
|
-
return knex.
|
|
108
|
+
return knex.dropTable(table.name);
|
|
101
109
|
}
|
|
102
110
|
class SqlTableQueryBuilder {
|
|
103
111
|
// pass through client to get flavour of SQL
|
|
@@ -115,7 +123,11 @@ class SqlTableQueryBuilder {
|
|
|
115
123
|
return json.endpoint.operation;
|
|
116
124
|
}
|
|
117
125
|
_tableQuery(json) {
|
|
118
|
-
|
|
126
|
+
var _a;
|
|
127
|
+
let client = knex_1.knex({ client: this.sqlClient }).schema;
|
|
128
|
+
if ((_a = json === null || json === void 0 ? void 0 : json.endpoint) === null || _a === void 0 ? void 0 : _a.schema) {
|
|
129
|
+
client = client.withSchema(json.endpoint.schema);
|
|
130
|
+
}
|
|
119
131
|
let query;
|
|
120
132
|
if (!json.table || !json.meta || !json.meta.tables) {
|
|
121
133
|
throw "Cannot execute without table being specified";
|
|
@@ -128,7 +140,7 @@ class SqlTableQueryBuilder {
|
|
|
128
140
|
if (!json.meta || !json.meta.table) {
|
|
129
141
|
throw "Must specify old table for update";
|
|
130
142
|
}
|
|
131
|
-
query = buildUpdateTable(client, json.table, json.meta.tables, json.meta.table);
|
|
143
|
+
query = buildUpdateTable(client, json.table, json.meta.tables, json.meta.table, json.meta.renamed);
|
|
132
144
|
break;
|
|
133
145
|
case datasource_1.Operation.DELETE_TABLE:
|
|
134
146
|
query = buildDeleteTable(client, json.table);
|
|
@@ -15,6 +15,7 @@ var MSSQLModule;
|
|
|
15
15
|
(function (MSSQLModule) {
|
|
16
16
|
const sqlServer = require("mssql");
|
|
17
17
|
const Sql = require("./base/sql");
|
|
18
|
+
const DEFAULT_SCHEMA = "dbo";
|
|
18
19
|
const SCHEMA = {
|
|
19
20
|
docs: "https://github.com/tediousjs/node-mssql",
|
|
20
21
|
plus: true,
|
|
@@ -43,6 +44,10 @@ var MSSQLModule;
|
|
|
43
44
|
type: datasource_1.DatasourceFieldTypes.STRING,
|
|
44
45
|
default: "root",
|
|
45
46
|
},
|
|
47
|
+
schema: {
|
|
48
|
+
type: datasource_1.DatasourceFieldTypes.STRING,
|
|
49
|
+
default: DEFAULT_SCHEMA,
|
|
50
|
+
},
|
|
46
51
|
encrypt: {
|
|
47
52
|
type: datasource_1.DatasourceFieldTypes.BOOLEAN,
|
|
48
53
|
default: true,
|
|
@@ -87,6 +92,20 @@ var MSSQLModule;
|
|
|
87
92
|
this.pool = new sqlServer.ConnectionPool(clientCfg);
|
|
88
93
|
}
|
|
89
94
|
}
|
|
95
|
+
getBindingIdentifier() {
|
|
96
|
+
return `(@p${this.index++})`;
|
|
97
|
+
}
|
|
98
|
+
connect() {
|
|
99
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
100
|
+
try {
|
|
101
|
+
this.client = yield this.pool.connect();
|
|
102
|
+
}
|
|
103
|
+
catch (err) {
|
|
104
|
+
// @ts-ignore
|
|
105
|
+
throw new Error(err);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
90
109
|
internalQuery(query, operation = undefined) {
|
|
91
110
|
return __awaiter(this, void 0, void 0, function* () {
|
|
92
111
|
const client = this.client;
|
|
@@ -137,20 +156,6 @@ var MSSQLModule;
|
|
|
137
156
|
FROM INFORMATION_SCHEMA.COLUMNS
|
|
138
157
|
WHERE TABLE_NAME='${tableName}'`;
|
|
139
158
|
}
|
|
140
|
-
getBindingIdentifier() {
|
|
141
|
-
return `(@p${this.index++})`;
|
|
142
|
-
}
|
|
143
|
-
connect() {
|
|
144
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
145
|
-
try {
|
|
146
|
-
this.client = yield this.pool.connect();
|
|
147
|
-
}
|
|
148
|
-
catch (err) {
|
|
149
|
-
// @ts-ignore
|
|
150
|
-
throw new Error(err);
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
159
|
runSQL(sql) {
|
|
155
160
|
return __awaiter(this, void 0, void 0, function* () {
|
|
156
161
|
return (yield this.internalQuery(utils_1.getSqlQuery(sql))).recordset;
|
|
@@ -164,11 +169,13 @@ var MSSQLModule;
|
|
|
164
169
|
buildSchema(datasourceId, entities) {
|
|
165
170
|
return __awaiter(this, void 0, void 0, function* () {
|
|
166
171
|
yield this.connect();
|
|
167
|
-
let
|
|
168
|
-
if (
|
|
172
|
+
let tableInfo = yield this.runSQL(this.TABLES_SQL);
|
|
173
|
+
if (tableInfo == null || !Array.isArray(tableInfo)) {
|
|
169
174
|
throw "Unable to get list of tables in database";
|
|
170
175
|
}
|
|
171
|
-
|
|
176
|
+
const schema = this.config.schema || DEFAULT_SCHEMA;
|
|
177
|
+
const tableNames = tableInfo
|
|
178
|
+
.filter((record) => record.TABLE_SCHEMA === schema)
|
|
172
179
|
.map((record) => record.TABLE_NAME)
|
|
173
180
|
.filter((name) => this.MASTER_TABLES.indexOf(name) === -1);
|
|
174
181
|
const tables = {};
|
|
@@ -240,7 +247,11 @@ var MSSQLModule;
|
|
|
240
247
|
}
|
|
241
248
|
query(json) {
|
|
242
249
|
return __awaiter(this, void 0, void 0, function* () {
|
|
250
|
+
const schema = this.config.schema;
|
|
243
251
|
yield this.connect();
|
|
252
|
+
if (schema && schema !== DEFAULT_SCHEMA && (json === null || json === void 0 ? void 0 : json.endpoint)) {
|
|
253
|
+
json.endpoint.schema = schema;
|
|
254
|
+
}
|
|
244
255
|
const operation = this._operation(json);
|
|
245
256
|
const queryFn = (query, op) => this.internalQuery(query, op);
|
|
246
257
|
const processFn = (result) => result.recordset ? result.recordset : [{ [operation]: true }];
|