cdk-drizzle-migrate 1.0.1 → 2.0.0
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/.jsii +244 -92
- package/API.md +32 -26
- package/CLAUDE.md +79 -0
- package/README.md +20 -6
- package/lib/drizzle-migrate-provider.d.ts +15 -7
- package/lib/drizzle-migrate-provider.js +82 -25
- package/lib/handler/handler.js +23300 -15071
- package/node_modules/@types/aws-lambda/README.md +1 -1
- package/node_modules/@types/aws-lambda/handler.d.ts +96 -0
- package/node_modules/@types/aws-lambda/package.json +3 -3
- package/node_modules/@types/aws-lambda/trigger/cloudfront-response.d.ts +8 -6
- package/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/index.d.ts +2 -0
- package/node_modules/@types/aws-lambda/trigger/cognito-user-pool-trigger/pre-token-generation-v3.d.ts +50 -0
- package/node_modules/@types/aws-lambda/trigger/guard-duty-event-notification.d.ts +1 -1
- package/package.json +30 -25
package/.jsii
CHANGED
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
]
|
|
8
8
|
},
|
|
9
9
|
"bundled": {
|
|
10
|
-
"@types/aws-lambda": "^8.10.
|
|
10
|
+
"@types/aws-lambda": "^8.10.152"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"aws-cdk-lib": "^2.
|
|
14
|
-
"constructs": "^10.
|
|
13
|
+
"aws-cdk-lib": "^2.207.0",
|
|
14
|
+
"constructs": "^10.4.2"
|
|
15
15
|
},
|
|
16
16
|
"dependencyClosure": {
|
|
17
17
|
"@aws-cdk/asset-awscli-v1": {
|
|
@@ -40,32 +40,6 @@
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
|
-
"@aws-cdk/asset-kubectl-v20": {
|
|
44
|
-
"targets": {
|
|
45
|
-
"dotnet": {
|
|
46
|
-
"namespace": "Amazon.CDK.Asset.KubectlV20",
|
|
47
|
-
"packageId": "Amazon.CDK.Asset.KubectlV20"
|
|
48
|
-
},
|
|
49
|
-
"go": {
|
|
50
|
-
"moduleName": "github.com/cdklabs/awscdk-asset-kubectl-go",
|
|
51
|
-
"packageName": "kubectlv20"
|
|
52
|
-
},
|
|
53
|
-
"java": {
|
|
54
|
-
"maven": {
|
|
55
|
-
"artifactId": "cdk-asset-kubectl-v20",
|
|
56
|
-
"groupId": "software.amazon.awscdk"
|
|
57
|
-
},
|
|
58
|
-
"package": "software.amazon.awscdk.cdk.asset.kubectl.v20"
|
|
59
|
-
},
|
|
60
|
-
"js": {
|
|
61
|
-
"npm": "@aws-cdk/asset-kubectl-v20"
|
|
62
|
-
},
|
|
63
|
-
"python": {
|
|
64
|
-
"distName": "aws-cdk.asset-kubectl-v20",
|
|
65
|
-
"module": "aws_cdk.asset_kubectl_v20"
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
43
|
"@aws-cdk/asset-node-proxy-agent-v6": {
|
|
70
44
|
"targets": {
|
|
71
45
|
"dotnet": {
|
|
@@ -189,6 +163,19 @@
|
|
|
189
163
|
}
|
|
190
164
|
}
|
|
191
165
|
},
|
|
166
|
+
"aws-cdk-lib.aws_aiops": {
|
|
167
|
+
"targets": {
|
|
168
|
+
"dotnet": {
|
|
169
|
+
"package": "Amazon.CDK.AWS.AIOps"
|
|
170
|
+
},
|
|
171
|
+
"java": {
|
|
172
|
+
"package": "software.amazon.awscdk.services.aiops"
|
|
173
|
+
},
|
|
174
|
+
"python": {
|
|
175
|
+
"module": "aws_cdk.aws_aiops"
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
},
|
|
192
179
|
"aws-cdk-lib.aws_amazonmq": {
|
|
193
180
|
"targets": {
|
|
194
181
|
"dotnet": {
|
|
@@ -970,6 +957,19 @@
|
|
|
970
957
|
}
|
|
971
958
|
}
|
|
972
959
|
},
|
|
960
|
+
"aws-cdk-lib.aws_cognito_identitypool": {
|
|
961
|
+
"targets": {
|
|
962
|
+
"dotnet": {
|
|
963
|
+
"namespace": "Amazon.CDK.AWS.Cognito.Identitypool"
|
|
964
|
+
},
|
|
965
|
+
"java": {
|
|
966
|
+
"package": "software.amazon.awscdk.services.cognito.identitypool"
|
|
967
|
+
},
|
|
968
|
+
"python": {
|
|
969
|
+
"module": "aws_cdk.aws_cognito_identitypool"
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
},
|
|
973
973
|
"aws-cdk-lib.aws_comprehend": {
|
|
974
974
|
"targets": {
|
|
975
975
|
"dotnet": {
|
|
@@ -1256,6 +1256,19 @@
|
|
|
1256
1256
|
}
|
|
1257
1257
|
}
|
|
1258
1258
|
},
|
|
1259
|
+
"aws-cdk-lib.aws_dsql": {
|
|
1260
|
+
"targets": {
|
|
1261
|
+
"dotnet": {
|
|
1262
|
+
"package": "Amazon.CDK.AWS.DSQL"
|
|
1263
|
+
},
|
|
1264
|
+
"java": {
|
|
1265
|
+
"package": "software.amazon.awscdk.services.dsql"
|
|
1266
|
+
},
|
|
1267
|
+
"python": {
|
|
1268
|
+
"module": "aws_cdk.aws_dsql"
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
},
|
|
1259
1272
|
"aws-cdk-lib.aws_dynamodb": {
|
|
1260
1273
|
"targets": {
|
|
1261
1274
|
"dotnet": {
|
|
@@ -1555,6 +1568,19 @@
|
|
|
1555
1568
|
}
|
|
1556
1569
|
}
|
|
1557
1570
|
},
|
|
1571
|
+
"aws-cdk-lib.aws_evs": {
|
|
1572
|
+
"targets": {
|
|
1573
|
+
"dotnet": {
|
|
1574
|
+
"package": "Amazon.CDK.AWS.EVS"
|
|
1575
|
+
},
|
|
1576
|
+
"java": {
|
|
1577
|
+
"package": "software.amazon.awscdk.services.evs"
|
|
1578
|
+
},
|
|
1579
|
+
"python": {
|
|
1580
|
+
"module": "aws_cdk.aws_evs"
|
|
1581
|
+
}
|
|
1582
|
+
}
|
|
1583
|
+
},
|
|
1558
1584
|
"aws-cdk-lib.aws_finspace": {
|
|
1559
1585
|
"targets": {
|
|
1560
1586
|
"dotnet": {
|
|
@@ -1646,6 +1672,19 @@
|
|
|
1646
1672
|
}
|
|
1647
1673
|
}
|
|
1648
1674
|
},
|
|
1675
|
+
"aws-cdk-lib.aws_gameliftstreams": {
|
|
1676
|
+
"targets": {
|
|
1677
|
+
"dotnet": {
|
|
1678
|
+
"package": "Amazon.CDK.AWS.GameLiftStreams"
|
|
1679
|
+
},
|
|
1680
|
+
"java": {
|
|
1681
|
+
"package": "software.amazon.awscdk.services.gameliftstreams"
|
|
1682
|
+
},
|
|
1683
|
+
"python": {
|
|
1684
|
+
"module": "aws_cdk.aws_gameliftstreams"
|
|
1685
|
+
}
|
|
1686
|
+
}
|
|
1687
|
+
},
|
|
1649
1688
|
"aws-cdk-lib.aws_globalaccelerator": {
|
|
1650
1689
|
"targets": {
|
|
1651
1690
|
"dotnet": {
|
|
@@ -1854,29 +1893,29 @@
|
|
|
1854
1893
|
}
|
|
1855
1894
|
}
|
|
1856
1895
|
},
|
|
1857
|
-
"aws-cdk-lib.
|
|
1896
|
+
"aws-cdk-lib.aws_invoicing": {
|
|
1858
1897
|
"targets": {
|
|
1859
1898
|
"dotnet": {
|
|
1860
|
-
"
|
|
1899
|
+
"package": "Amazon.CDK.AWS.Invoicing"
|
|
1861
1900
|
},
|
|
1862
1901
|
"java": {
|
|
1863
|
-
"package": "software.amazon.awscdk.services.
|
|
1902
|
+
"package": "software.amazon.awscdk.services.invoicing"
|
|
1864
1903
|
},
|
|
1865
1904
|
"python": {
|
|
1866
|
-
"module": "aws_cdk.
|
|
1905
|
+
"module": "aws_cdk.aws_invoicing"
|
|
1867
1906
|
}
|
|
1868
1907
|
}
|
|
1869
1908
|
},
|
|
1870
|
-
"aws-cdk-lib.
|
|
1909
|
+
"aws-cdk-lib.aws_iot": {
|
|
1871
1910
|
"targets": {
|
|
1872
1911
|
"dotnet": {
|
|
1873
|
-
"namespace": "Amazon.CDK.AWS.
|
|
1912
|
+
"namespace": "Amazon.CDK.AWS.IoT"
|
|
1874
1913
|
},
|
|
1875
1914
|
"java": {
|
|
1876
|
-
"package": "software.amazon.awscdk.services.
|
|
1915
|
+
"package": "software.amazon.awscdk.services.iot"
|
|
1877
1916
|
},
|
|
1878
1917
|
"python": {
|
|
1879
|
-
"module": "aws_cdk.
|
|
1918
|
+
"module": "aws_cdk.aws_iot"
|
|
1880
1919
|
}
|
|
1881
1920
|
}
|
|
1882
1921
|
},
|
|
@@ -2478,6 +2517,19 @@
|
|
|
2478
2517
|
}
|
|
2479
2518
|
}
|
|
2480
2519
|
},
|
|
2520
|
+
"aws-cdk-lib.aws_mpa": {
|
|
2521
|
+
"targets": {
|
|
2522
|
+
"dotnet": {
|
|
2523
|
+
"package": "Amazon.CDK.AWS.MPA"
|
|
2524
|
+
},
|
|
2525
|
+
"java": {
|
|
2526
|
+
"package": "software.amazon.awscdk.services.mpa"
|
|
2527
|
+
},
|
|
2528
|
+
"python": {
|
|
2529
|
+
"module": "aws_cdk.aws_mpa"
|
|
2530
|
+
}
|
|
2531
|
+
}
|
|
2532
|
+
},
|
|
2481
2533
|
"aws-cdk-lib.aws_msk": {
|
|
2482
2534
|
"targets": {
|
|
2483
2535
|
"dotnet": {
|
|
@@ -2569,6 +2621,32 @@
|
|
|
2569
2621
|
}
|
|
2570
2622
|
}
|
|
2571
2623
|
},
|
|
2624
|
+
"aws-cdk-lib.aws_notifications": {
|
|
2625
|
+
"targets": {
|
|
2626
|
+
"dotnet": {
|
|
2627
|
+
"package": "Amazon.CDK.AWS.Notifications"
|
|
2628
|
+
},
|
|
2629
|
+
"java": {
|
|
2630
|
+
"package": "software.amazon.awscdk.services.notifications"
|
|
2631
|
+
},
|
|
2632
|
+
"python": {
|
|
2633
|
+
"module": "aws_cdk.aws_notifications"
|
|
2634
|
+
}
|
|
2635
|
+
}
|
|
2636
|
+
},
|
|
2637
|
+
"aws-cdk-lib.aws_notificationscontacts": {
|
|
2638
|
+
"targets": {
|
|
2639
|
+
"dotnet": {
|
|
2640
|
+
"package": "Amazon.CDK.AWS.NotificationsContacts"
|
|
2641
|
+
},
|
|
2642
|
+
"java": {
|
|
2643
|
+
"package": "software.amazon.awscdk.services.notificationscontacts"
|
|
2644
|
+
},
|
|
2645
|
+
"python": {
|
|
2646
|
+
"module": "aws_cdk.aws_notificationscontacts"
|
|
2647
|
+
}
|
|
2648
|
+
}
|
|
2649
|
+
},
|
|
2572
2650
|
"aws-cdk-lib.aws_oam": {
|
|
2573
2651
|
"targets": {
|
|
2574
2652
|
"dotnet": {
|
|
@@ -2582,6 +2660,19 @@
|
|
|
2582
2660
|
}
|
|
2583
2661
|
}
|
|
2584
2662
|
},
|
|
2663
|
+
"aws-cdk-lib.aws_odb": {
|
|
2664
|
+
"targets": {
|
|
2665
|
+
"dotnet": {
|
|
2666
|
+
"package": "Amazon.CDK.AWS.ODB"
|
|
2667
|
+
},
|
|
2668
|
+
"java": {
|
|
2669
|
+
"package": "software.amazon.awscdk.services.odb"
|
|
2670
|
+
},
|
|
2671
|
+
"python": {
|
|
2672
|
+
"module": "aws_cdk.aws_odb"
|
|
2673
|
+
}
|
|
2674
|
+
}
|
|
2675
|
+
},
|
|
2585
2676
|
"aws-cdk-lib.aws_omics": {
|
|
2586
2677
|
"targets": {
|
|
2587
2678
|
"dotnet": {
|
|
@@ -2725,6 +2816,19 @@
|
|
|
2725
2816
|
}
|
|
2726
2817
|
}
|
|
2727
2818
|
},
|
|
2819
|
+
"aws-cdk-lib.aws_pcs": {
|
|
2820
|
+
"targets": {
|
|
2821
|
+
"dotnet": {
|
|
2822
|
+
"package": "Amazon.CDK.AWS.PCS"
|
|
2823
|
+
},
|
|
2824
|
+
"java": {
|
|
2825
|
+
"package": "software.amazon.awscdk.services.pcs"
|
|
2826
|
+
},
|
|
2827
|
+
"python": {
|
|
2828
|
+
"module": "aws_cdk.aws_pcs"
|
|
2829
|
+
}
|
|
2830
|
+
}
|
|
2831
|
+
},
|
|
2728
2832
|
"aws-cdk-lib.aws_personalize": {
|
|
2729
2833
|
"targets": {
|
|
2730
2834
|
"dotnet": {
|
|
@@ -3180,6 +3284,19 @@
|
|
|
3180
3284
|
}
|
|
3181
3285
|
}
|
|
3182
3286
|
},
|
|
3287
|
+
"aws-cdk-lib.aws_s3tables": {
|
|
3288
|
+
"targets": {
|
|
3289
|
+
"dotnet": {
|
|
3290
|
+
"package": "Amazon.CDK.AWS.S3Tables"
|
|
3291
|
+
},
|
|
3292
|
+
"java": {
|
|
3293
|
+
"package": "software.amazon.awscdk.services.s3tables"
|
|
3294
|
+
},
|
|
3295
|
+
"python": {
|
|
3296
|
+
"module": "aws_cdk.aws_s3tables"
|
|
3297
|
+
}
|
|
3298
|
+
}
|
|
3299
|
+
},
|
|
3183
3300
|
"aws-cdk-lib.aws_sagemaker": {
|
|
3184
3301
|
"targets": {
|
|
3185
3302
|
"dotnet": {
|
|
@@ -3219,6 +3336,19 @@
|
|
|
3219
3336
|
}
|
|
3220
3337
|
}
|
|
3221
3338
|
},
|
|
3339
|
+
"aws-cdk-lib.aws_scheduler_targets": {
|
|
3340
|
+
"targets": {
|
|
3341
|
+
"dotnet": {
|
|
3342
|
+
"namespace": "Amazon.CDK.AWS.Scheduler.Targets"
|
|
3343
|
+
},
|
|
3344
|
+
"java": {
|
|
3345
|
+
"package": "software.amazon.awscdk.services.scheduler.targets"
|
|
3346
|
+
},
|
|
3347
|
+
"python": {
|
|
3348
|
+
"module": "aws_cdk.aws_scheduler_targets"
|
|
3349
|
+
}
|
|
3350
|
+
}
|
|
3351
|
+
},
|
|
3222
3352
|
"aws-cdk-lib.aws_sdb": {
|
|
3223
3353
|
"targets": {
|
|
3224
3354
|
"dotnet": {
|
|
@@ -3440,6 +3570,19 @@
|
|
|
3440
3570
|
}
|
|
3441
3571
|
}
|
|
3442
3572
|
},
|
|
3573
|
+
"aws-cdk-lib.aws_ssmguiconnect": {
|
|
3574
|
+
"targets": {
|
|
3575
|
+
"dotnet": {
|
|
3576
|
+
"package": "Amazon.CDK.AWS.SSMGuiConnect"
|
|
3577
|
+
},
|
|
3578
|
+
"java": {
|
|
3579
|
+
"package": "software.amazon.awscdk.services.ssmguiconnect"
|
|
3580
|
+
},
|
|
3581
|
+
"python": {
|
|
3582
|
+
"module": "aws_cdk.aws_ssmguiconnect"
|
|
3583
|
+
}
|
|
3584
|
+
}
|
|
3585
|
+
},
|
|
3443
3586
|
"aws-cdk-lib.aws_ssmincidents": {
|
|
3444
3587
|
"targets": {
|
|
3445
3588
|
"dotnet": {
|
|
@@ -3674,6 +3817,19 @@
|
|
|
3674
3817
|
}
|
|
3675
3818
|
}
|
|
3676
3819
|
},
|
|
3820
|
+
"aws-cdk-lib.aws_workspacesinstances": {
|
|
3821
|
+
"targets": {
|
|
3822
|
+
"dotnet": {
|
|
3823
|
+
"package": "Amazon.CDK.AWS.WorkspacesInstances"
|
|
3824
|
+
},
|
|
3825
|
+
"java": {
|
|
3826
|
+
"package": "software.amazon.awscdk.services.workspacesinstances"
|
|
3827
|
+
},
|
|
3828
|
+
"python": {
|
|
3829
|
+
"module": "aws_cdk.aws_workspacesinstances"
|
|
3830
|
+
}
|
|
3831
|
+
}
|
|
3832
|
+
},
|
|
3677
3833
|
"aws-cdk-lib.aws_workspacesthinclient": {
|
|
3678
3834
|
"targets": {
|
|
3679
3835
|
"dotnet": {
|
|
@@ -3766,19 +3922,6 @@
|
|
|
3766
3922
|
}
|
|
3767
3923
|
}
|
|
3768
3924
|
},
|
|
3769
|
-
"aws-cdk-lib.lambda_layer_kubectl": {
|
|
3770
|
-
"targets": {
|
|
3771
|
-
"dotnet": {
|
|
3772
|
-
"namespace": "Amazon.CDK.LambdaLayer.Kubectl"
|
|
3773
|
-
},
|
|
3774
|
-
"java": {
|
|
3775
|
-
"package": "software.amazon.awscdk.lambdalayer.kubectl"
|
|
3776
|
-
},
|
|
3777
|
-
"python": {
|
|
3778
|
-
"module": "aws_cdk.lambda_layer_kubectl"
|
|
3779
|
-
}
|
|
3780
|
-
}
|
|
3781
|
-
},
|
|
3782
3925
|
"aws-cdk-lib.lambda_layer_node_proxy_agent": {
|
|
3783
3926
|
"targets": {
|
|
3784
3927
|
"dotnet": {
|
|
@@ -3889,7 +4032,7 @@
|
|
|
3889
4032
|
"stability": "stable"
|
|
3890
4033
|
},
|
|
3891
4034
|
"homepage": "https://github.com/berenddeboer/cdk-drizzle-migrate.git",
|
|
3892
|
-
"jsiiVersion": "5.
|
|
4035
|
+
"jsiiVersion": "5.9.4 (build db676e9)",
|
|
3893
4036
|
"keywords": [
|
|
3894
4037
|
"aurora",
|
|
3895
4038
|
"aws",
|
|
@@ -3911,7 +4054,7 @@
|
|
|
3911
4054
|
},
|
|
3912
4055
|
"name": "cdk-drizzle-migrate",
|
|
3913
4056
|
"readme": {
|
|
3914
|
-
"markdown": "# About\n\nThis CDK construct library makes it possible to run the drizzle\nmigrate at deploy of your stack time against the RDS cluster of your\nchoice. The supported engines are PostgreSQL, MariaDB and MySQL.\n\nThis construct library is intended to be used in enterprise\nenvironments, and works in isolated subnets.\n\n<p align=\"left\">\n <a href=\"https://github.com/semantic-release/semantic-release\"><img src=\"https://img.shields.io/badge/semantic--release-angular-e10079?logo=semantic-release\" alt=semantic-release: angular\"></a>\n <a href=\"https://github.com/berenddeboer/cdk-rds-sql/actions/workflows/release.yml\"><img src=\"https://github.com/berenddeboer/cdk-rds-sql/actions/workflows/release.yml/badge.svg\" alt=\"Release badge\"></a>\n</p>\n\n# Requirements\n\nThis package assumes you deploy from a unix shell with access to `cp`,\n`mkdir`, and `curl`.\n\n# Installation\n\n npm i cdk-drizzle-migrate\n\nYou probably will be very unhappy if you don't have esbuild, so as\nusual in a cdk typescript project make sure that is installed too:\n\n npm i esbuild\n\nAnd obviously drizzle-kit and drizzle-orm should be available if you\nactually want to create migrations.\n\n# Usage\n\nHave an RDS database and a secret that stores your db\ncredentials. Usually this will be the root secret for your RDS\ndatabase:\n\n```ts\nimport { DrizzleMigrate } from \"@berenddeboer/cdk-drizzle-migrate\"\n\n// Create the DrizzleMigrate construct\nconst migrator = new DrizzleMigrate(this, \"DrizzleMigration\", {\n dbSecret: database.secret!,\n migrationsPath: \"migrations\",\n vpc: vpc,\n vpcSubnets: {\n subnetType: ec2.SubnetType.PRIVATE_ISOLATED,\n },\n cluster: database, // Pass the database instance to allow automatic security group configuration\n})\n```\n\nYour secret should look like the standard one created by CDK:\n\n```json\n{\n \"password\": \"some-password\",\n \"dbname\": \"testdb\",\n \"engine\": \"postgres\",\n \"port\": 5432,\n \"dbInstanceIdentifier\": \"some-name\",\n \"host\": \"some-name.cvabql2flhit.us-east-1.rds.amazonaws.com\",\n \"username\": \"postgres\"\n}\n```\n\nSpecify the path where the migrations are stored, `migrations` in this case.\n\nWhen this resource is deployed, it will run `drizzle-kit migrate` for\nyou in the lambda.\n\nThe default timeout is 5 minutes, you need to increase this if your\nmigration takes more time.\n\nPassing your database cluster is optional. If supplied, the lambda's\nsecurity group will be added as allowed source to the database\nsecurity group if no security group is present in\n`handlerProps.securityGroups`.\n\nIf you do not pass a cluster, make sure to pass in a security group in\n`handlerProps.securityGroups` which can connect to your database.\n\nAlso if you do not pass a cluster
|
|
4057
|
+
"markdown": "# About\n\nThis CDK construct library makes it possible to run the drizzle\nmigrate at deploy of your stack time against the RDS or DSQL cluster of your\nchoice. The supported engines are PostgreSQL, MariaDB and MySQL.\n\nThis construct library is intended to be used in enterprise\nenvironments, and works in isolated subnets.\n\n<p align=\"left\">\n <a href=\"https://github.com/semantic-release/semantic-release\"><img src=\"https://img.shields.io/badge/semantic--release-angular-e10079?logo=semantic-release\" alt=semantic-release: angular\"></a>\n <a href=\"https://github.com/berenddeboer/cdk-rds-sql/actions/workflows/release.yml\"><img src=\"https://github.com/berenddeboer/cdk-rds-sql/actions/workflows/release.yml/badge.svg\" alt=\"Release badge\"></a>\n</p>\n\n# Requirements\n\nThis package assumes you deploy from a unix shell with access to `cp`,\n`mkdir`, and `curl`.\n\n# Installation\n\n npm i cdk-drizzle-migrate\n\nYou probably will be very unhappy if you don't have esbuild, so as\nusual in a cdk typescript project make sure that is installed too:\n\n npm i esbuild\n\nAnd obviously drizzle-kit and drizzle-orm should be available if you\nactually want to create migrations.\n\n# Usage\n\n## RDS and Aurora\n\nHave an RDS database and a secret that stores your db\ncredentials. Usually this will be the root secret for your RDS\ndatabase:\n\n```ts\nimport { DrizzleMigrate } from \"@berenddeboer/cdk-drizzle-migrate\"\n\n// Create the DrizzleMigrate construct\nconst migrator = new DrizzleMigrate(this, \"DrizzleMigration\", {\n dbSecret: database.secret!,\n migrationsPath: \"migrations\",\n vpc: vpc,\n vpcSubnets: {\n subnetType: ec2.SubnetType.PRIVATE_ISOLATED,\n },\n cluster: database, // Pass the database instance to allow automatic security group configuration\n})\n```\n\nYour secret should look like the standard one created by CDK:\n\n```json\n{\n \"password\": \"some-password\",\n \"dbname\": \"testdb\",\n \"engine\": \"postgres\",\n \"port\": 5432,\n \"dbInstanceIdentifier\": \"some-name\",\n \"host\": \"some-name.cvabql2flhit.us-east-1.rds.amazonaws.com\",\n \"username\": \"postgres\"\n}\n```\n\n## DSQL\n\nFor DSQL there is no secret where credentials are stored. Only IAM\naccess is supported.\n\nDrizzle doesn't really support DSQL, so if you create migrations you\nwill often need to tweak them manually as so little of postgresql is\nsupported.\n\n## Migrations\n\nSpecify the path where the migrations are stored, `migrations` in this case.\n\nWhen this resource is deployed, it will run `drizzle-kit migrate` for\nyou in the lambda.\n\nThe default timeout is 5 minutes, you need to increase this if your\nmigration takes more time.\n\nPassing your database cluster is optional. If supplied, the lambda's\nsecurity group will be added as allowed source to the database\nsecurity group if no security group is present in\n`handlerProps.securityGroups`.\n\nIf you do not pass a cluster, make sure to pass in a security group in\n`handlerProps.securityGroups` which can connect to your database.\n\nAlso if you do not pass a cluster, but you still want to create a\ndatabase, you may wish to add a dependency to make sure the database\nis created, before the migration is run:\n\n```ts\nmigrator.resource.node.addDependency(cluster)\n```\n\n# Potential pitfalls\n\n1. The lambda can only run for 15 minutes. If your migrations take\n longer, this solution will not work.\n\n# Working on this code\n\n1. Install packages: `npm ci`\n\n2. Bootstrap CDK if not done: `npx cdk bootstrap\n aws://123456/us-east-1`. Replace 123456 with your AWS account.\n\n## Handler notes\n\nWhen making changes to the Lambda handler code in `lambda/index.ts`,\nyou need to transpile it to JavaScript:\n\n```bash\nnpx projen build:handler\n```\n\nThis will generate `src/handler/handler.js` which is used by the CDK\nconstruct.\n\nThis technique is used to avoid having to bundle nodejs dependencies\nas that doesn't work well in this case.\n"
|
|
3915
4058
|
},
|
|
3916
4059
|
"repository": {
|
|
3917
4060
|
"type": "git",
|
|
@@ -3938,7 +4081,7 @@
|
|
|
3938
4081
|
},
|
|
3939
4082
|
"locationInModule": {
|
|
3940
4083
|
"filename": "src/drizzle-migrate-provider.ts",
|
|
3941
|
-
"line":
|
|
4084
|
+
"line": 90
|
|
3942
4085
|
},
|
|
3943
4086
|
"parameters": [
|
|
3944
4087
|
{
|
|
@@ -3964,7 +4107,7 @@
|
|
|
3964
4107
|
"kind": "class",
|
|
3965
4108
|
"locationInModule": {
|
|
3966
4109
|
"filename": "src/drizzle-migrate-provider.ts",
|
|
3967
|
-
"line":
|
|
4110
|
+
"line": 79
|
|
3968
4111
|
},
|
|
3969
4112
|
"name": "DrizzleMigrate",
|
|
3970
4113
|
"properties": [
|
|
@@ -3976,7 +4119,7 @@
|
|
|
3976
4119
|
"immutable": true,
|
|
3977
4120
|
"locationInModule": {
|
|
3978
4121
|
"filename": "src/drizzle-migrate-provider.ts",
|
|
3979
|
-
"line":
|
|
4122
|
+
"line": 88
|
|
3980
4123
|
},
|
|
3981
4124
|
"name": "handler",
|
|
3982
4125
|
"type": {
|
|
@@ -3991,7 +4134,7 @@
|
|
|
3991
4134
|
"immutable": true,
|
|
3992
4135
|
"locationInModule": {
|
|
3993
4136
|
"filename": "src/drizzle-migrate-provider.ts",
|
|
3994
|
-
"line":
|
|
4137
|
+
"line": 83
|
|
3995
4138
|
},
|
|
3996
4139
|
"name": "resource",
|
|
3997
4140
|
"type": {
|
|
@@ -4012,7 +4155,7 @@
|
|
|
4012
4155
|
"kind": "interface",
|
|
4013
4156
|
"locationInModule": {
|
|
4014
4157
|
"filename": "src/drizzle-migrate-provider.ts",
|
|
4015
|
-
"line":
|
|
4158
|
+
"line": 28
|
|
4016
4159
|
},
|
|
4017
4160
|
"name": "DrizzleMigrateProps",
|
|
4018
4161
|
"properties": [
|
|
@@ -4020,93 +4163,102 @@
|
|
|
4020
4163
|
"abstract": true,
|
|
4021
4164
|
"docs": {
|
|
4022
4165
|
"stability": "stable",
|
|
4023
|
-
"summary": "The
|
|
4166
|
+
"summary": "The path to the migrations directory This directory will be bundled with the Lambda function."
|
|
4024
4167
|
},
|
|
4025
4168
|
"immutable": true,
|
|
4026
4169
|
"locationInModule": {
|
|
4027
4170
|
"filename": "src/drizzle-migrate-provider.ts",
|
|
4028
|
-
"line":
|
|
4171
|
+
"line": 42
|
|
4029
4172
|
},
|
|
4030
|
-
"name": "
|
|
4173
|
+
"name": "migrationsPath",
|
|
4031
4174
|
"type": {
|
|
4032
|
-
"
|
|
4175
|
+
"primitive": "string"
|
|
4033
4176
|
}
|
|
4034
4177
|
},
|
|
4035
4178
|
{
|
|
4036
4179
|
"abstract": true,
|
|
4037
4180
|
"docs": {
|
|
4181
|
+
"default": "- No database connection is configured",
|
|
4038
4182
|
"stability": "stable",
|
|
4039
|
-
"summary": "
|
|
4183
|
+
"summary": "Optional database cluster or instance Supports both traditional RDS/Aurora clusters and DSQL clusters - For RDS/Aurora: security groups will be configured to allow access - For DSQL: IAM authentication will be used instead of secrets."
|
|
4040
4184
|
},
|
|
4041
4185
|
"immutable": true,
|
|
4042
4186
|
"locationInModule": {
|
|
4043
4187
|
"filename": "src/drizzle-migrate-provider.ts",
|
|
4044
|
-
"line":
|
|
4188
|
+
"line": 73
|
|
4045
4189
|
},
|
|
4046
|
-
"name": "
|
|
4190
|
+
"name": "cluster",
|
|
4191
|
+
"optional": true,
|
|
4047
4192
|
"type": {
|
|
4048
|
-
"
|
|
4193
|
+
"union": {
|
|
4194
|
+
"types": [
|
|
4195
|
+
{
|
|
4196
|
+
"fqn": "aws-cdk-lib.aws_rds.IDatabaseCluster"
|
|
4197
|
+
},
|
|
4198
|
+
{
|
|
4199
|
+
"fqn": "aws-cdk-lib.aws_rds.IDatabaseInstance"
|
|
4200
|
+
},
|
|
4201
|
+
{
|
|
4202
|
+
"fqn": "aws-cdk-lib.aws_dsql.CfnCluster"
|
|
4203
|
+
}
|
|
4204
|
+
]
|
|
4205
|
+
}
|
|
4049
4206
|
}
|
|
4050
4207
|
},
|
|
4051
4208
|
{
|
|
4052
4209
|
"abstract": true,
|
|
4053
4210
|
"docs": {
|
|
4211
|
+
"default": "- undefined for DSQL clusters using IAM authentication",
|
|
4212
|
+
"remarks": "Not required when relying on IAM authentication (such as DSQL).",
|
|
4054
4213
|
"stability": "stable",
|
|
4055
|
-
"summary": "The
|
|
4214
|
+
"summary": "The database secret containing connection details Must contain standard CDK database secret properties: username, password, host, port, engine, etc."
|
|
4056
4215
|
},
|
|
4057
4216
|
"immutable": true,
|
|
4058
4217
|
"locationInModule": {
|
|
4059
4218
|
"filename": "src/drizzle-migrate-provider.ts",
|
|
4060
|
-
"line":
|
|
4219
|
+
"line": 36
|
|
4061
4220
|
},
|
|
4062
|
-
"name": "
|
|
4221
|
+
"name": "dbSecret",
|
|
4222
|
+
"optional": true,
|
|
4063
4223
|
"type": {
|
|
4064
|
-
"fqn": "aws-cdk-lib.
|
|
4224
|
+
"fqn": "aws-cdk-lib.aws_secretsmanager.ISecret"
|
|
4065
4225
|
}
|
|
4066
4226
|
},
|
|
4067
4227
|
{
|
|
4068
4228
|
"abstract": true,
|
|
4069
4229
|
"docs": {
|
|
4070
|
-
"default": "-
|
|
4230
|
+
"default": "- Default Lambda configuration is used",
|
|
4071
4231
|
"stability": "stable",
|
|
4072
|
-
"summary": "Optional
|
|
4232
|
+
"summary": "Optional properties to customize the Lambda function Excludes runtime, entry, and handler which are managed by the construct."
|
|
4073
4233
|
},
|
|
4074
4234
|
"immutable": true,
|
|
4075
4235
|
"locationInModule": {
|
|
4076
4236
|
"filename": "src/drizzle-migrate-provider.ts",
|
|
4077
|
-
"line":
|
|
4237
|
+
"line": 49
|
|
4078
4238
|
},
|
|
4079
|
-
"name": "
|
|
4239
|
+
"name": "handlerProps",
|
|
4080
4240
|
"optional": true,
|
|
4081
4241
|
"type": {
|
|
4082
|
-
"
|
|
4083
|
-
"types": [
|
|
4084
|
-
{
|
|
4085
|
-
"fqn": "aws-cdk-lib.aws_rds.IDatabaseCluster"
|
|
4086
|
-
},
|
|
4087
|
-
{
|
|
4088
|
-
"fqn": "aws-cdk-lib.aws_rds.IDatabaseInstance"
|
|
4089
|
-
}
|
|
4090
|
-
]
|
|
4091
|
-
}
|
|
4242
|
+
"fqn": "aws-cdk-lib.aws_lambda_nodejs.NodejsFunctionProps"
|
|
4092
4243
|
}
|
|
4093
4244
|
},
|
|
4094
4245
|
{
|
|
4095
4246
|
"abstract": true,
|
|
4096
4247
|
"docs": {
|
|
4097
|
-
"default": "-
|
|
4248
|
+
"default": "- use VPC of your RDS/Aurora cluster",
|
|
4249
|
+
"remarks": "Not required for DSQL as it uses public endpoints with IAM authentication",
|
|
4098
4250
|
"stability": "stable",
|
|
4099
|
-
"summary": "
|
|
4251
|
+
"summary": "The VPC where the Lambda function will be deployed Required when your database is only accessible in a VPC."
|
|
4100
4252
|
},
|
|
4101
4253
|
"immutable": true,
|
|
4102
4254
|
"locationInModule": {
|
|
4103
4255
|
"filename": "src/drizzle-migrate-provider.ts",
|
|
4104
|
-
"line":
|
|
4256
|
+
"line": 57
|
|
4105
4257
|
},
|
|
4106
|
-
"name": "
|
|
4258
|
+
"name": "vpc",
|
|
4107
4259
|
"optional": true,
|
|
4108
4260
|
"type": {
|
|
4109
|
-
"fqn": "aws-cdk-lib.
|
|
4261
|
+
"fqn": "aws-cdk-lib.aws_ec2.IVpc"
|
|
4110
4262
|
}
|
|
4111
4263
|
},
|
|
4112
4264
|
{
|
|
@@ -4114,12 +4266,12 @@
|
|
|
4114
4266
|
"docs": {
|
|
4115
4267
|
"default": "- PRIVATE_WITH_EGRESS subnets",
|
|
4116
4268
|
"stability": "stable",
|
|
4117
|
-
"summary": "Optional subnet selection to deploy the Lambda function."
|
|
4269
|
+
"summary": "Optional subnet selection to deploy the Lambda function Only used when vpc is specified."
|
|
4118
4270
|
},
|
|
4119
4271
|
"immutable": true,
|
|
4120
4272
|
"locationInModule": {
|
|
4121
4273
|
"filename": "src/drizzle-migrate-provider.ts",
|
|
4122
|
-
"line":
|
|
4274
|
+
"line": 64
|
|
4123
4275
|
},
|
|
4124
4276
|
"name": "vpcSubnets",
|
|
4125
4277
|
"optional": true,
|
|
@@ -4131,6 +4283,6 @@
|
|
|
4131
4283
|
"symbolId": "src/drizzle-migrate-provider:DrizzleMigrateProps"
|
|
4132
4284
|
}
|
|
4133
4285
|
},
|
|
4134
|
-
"version": "
|
|
4135
|
-
"fingerprint": "
|
|
4286
|
+
"version": "2.0.0",
|
|
4287
|
+
"fingerprint": "L2exAV7r0S/CZSvZUqR8DabQKuKcAEQLyF2wP9WY0X0="
|
|
4136
4288
|
}
|