@dbml/connector 5.2.0 → 5.3.1

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.
Files changed (46) hide show
  1. package/__tests__/connector.test.ts +1 -1
  2. package/__tests__/connectors/mssql/out-files/schema.json +37 -253
  3. package/__tests__/connectors/mysql/expect-out-files/schema.json +1 -1
  4. package/__tests__/connectors/oracle/connection.json +4 -0
  5. package/__tests__/connectors/oracle/expect-out-files/schema.json +3866 -0
  6. package/dist/connectors/{bigqueryConnector.d.ts → bigquery/index.d.ts} +1 -1
  7. package/dist/connectors/{bigqueryConnector.js → bigquery/index.js} +2 -2
  8. package/dist/connectors/connector.js +13 -10
  9. package/dist/connectors/{mssqlConnector.d.ts → mssql/index.d.ts} +1 -1
  10. package/dist/connectors/{mssqlConnector.js → mssql/index.js} +1 -1
  11. package/dist/connectors/{mysqlConnector.d.ts → mysql/index.d.ts} +1 -1
  12. package/dist/connectors/oracle/constraints.d.ts +7 -0
  13. package/dist/connectors/oracle/constraints.js +112 -0
  14. package/dist/connectors/oracle/index.d.ts +3 -0
  15. package/dist/connectors/oracle/index.js +68 -0
  16. package/dist/connectors/oracle/indexes.d.ts +3 -0
  17. package/dist/connectors/oracle/indexes.js +65 -0
  18. package/dist/connectors/oracle/refs.d.ts +3 -0
  19. package/dist/connectors/oracle/refs.js +67 -0
  20. package/dist/connectors/oracle/tables.d.ts +7 -0
  21. package/dist/connectors/oracle/tables.js +280 -0
  22. package/dist/connectors/oracle/utils.d.ts +9 -0
  23. package/dist/connectors/oracle/utils.js +27 -0
  24. package/dist/connectors/{snowflakeConnector.d.ts → postgres/index.d.ts} +1 -1
  25. package/dist/connectors/{postgresConnector.js → postgres/index.js} +1 -1
  26. package/dist/connectors/{postgresConnector.d.ts → snowflake/index.d.ts} +1 -1
  27. package/dist/connectors/{snowflakeConnector.js → snowflake/index.js} +1 -1
  28. package/dist/connectors/types.d.ts +1 -1
  29. package/package.json +5 -3
  30. package/src/connectors/{bigqueryConnector.ts → bigquery/index.ts} +3 -3
  31. package/src/connectors/connector.ts +8 -5
  32. package/src/connectors/{mssqlConnector.ts → mssql/index.ts} +2 -2
  33. package/src/connectors/{mysqlConnector.ts → mysql/index.ts} +1 -1
  34. package/src/connectors/oracle/constraints.ts +113 -0
  35. package/src/connectors/oracle/index.ts +76 -0
  36. package/src/connectors/oracle/indexes.ts +71 -0
  37. package/src/connectors/oracle/refs.ts +73 -0
  38. package/src/connectors/oracle/tables.ts +305 -0
  39. package/src/connectors/oracle/utils.ts +23 -0
  40. package/src/connectors/{postgresConnector.ts → postgres/index.ts} +2 -2
  41. package/src/connectors/{snowflakeConnector.ts → snowflake/index.ts} +2 -2
  42. package/src/connectors/types.ts +1 -0
  43. package/__tests__/connectors/mysql/out-files/schema.json +0 -1430
  44. package/__tests__/connectors/postgres/out-files/schema.json +0 -1719
  45. package/test-output.log +0 -18
  46. /package/dist/connectors/{mysqlConnector.js → mysql/index.js} +0 -0
@@ -43,5 +43,5 @@ describe('@dbml/connector', () => {
43
43
 
44
44
  test.each(scanDirNames(__dirname, 'connectors'))('connectors/%s', async (dirName) => {
45
45
  await runTest(path.join(__dirname, 'connectors', dirName));
46
- });
46
+ }, 10000);
47
47
  });
@@ -97,27 +97,6 @@
97
97
  "note": {
98
98
  "value": ""
99
99
  }
100
- },
101
- {
102
- "name": "AddressInfo",
103
- "schemaName": "dbo",
104
- "note": {
105
- "value": ""
106
- }
107
- },
108
- {
109
- "name": "AddressInfo2",
110
- "schemaName": "dbo",
111
- "note": {
112
- "value": ""
113
- }
114
- },
115
- {
116
- "name": "TestDescriptionTable",
117
- "schemaName": "dbo",
118
- "note": {
119
- "value": "This is the custom comment name on table."
120
- }
121
100
  }
122
101
  ],
123
102
  "fields": {
@@ -475,8 +454,8 @@
475
454
  {
476
455
  "name": "status",
477
456
  "type": {
478
- "type_name": "varchar(20)",
479
- "schemaName": null
457
+ "type_name": "chk_status",
458
+ "schemaName": "dbo"
480
459
  },
481
460
  "dbdefault": {
482
461
  "type": "string",
@@ -1162,7 +1141,7 @@
1162
1141
  },
1163
1142
  "dbdefault": {
1164
1143
  "type": "string",
1165
- "value": "<Books>\n <Book>\n <Title>The Great Gatsby</Title>\n <Author>F. Scott Fitzgerald</Author>\n <Year>1925</Year>\n <Price>10.99</Price>\n <Publisher>Scribner</Publisher>\n <Location>New York</Location>\n <Genre>Fiction</Genre>\n <Subgenre>Classic</Subgenre>\n </Book>\n <Book>\n <Title>1984</Title>\n <Author>George Orwell</Author>\n <Year>1949</Year>\n <Price>8.99</Price>\n <Publisher>Secker & Warburg</Publisher>\n <Location>London</Location>\n <Genre>Dystopian</Genre>\n <Subgenre>Political Fiction</Subgenre>\n </Book>\n </Books>"
1144
+ "value": "<Books>\r\n <Book>\r\n <Title>The Great Gatsby</Title>\r\n <Author>F. Scott Fitzgerald</Author>\r\n <Year>1925</Year>\r\n <Price>10.99</Price>\r\n <Publisher>Scribner</Publisher>\r\n <Location>New York</Location>\r\n <Genre>Fiction</Genre>\r\n <Subgenre>Classic</Subgenre>\r\n </Book>\r\n <Book>\r\n <Title>1984</Title>\r\n <Author>George Orwell</Author>\r\n <Year>1949</Year>\r\n <Price>8.99</Price>\r\n <Publisher>Secker & Warburg</Publisher>\r\n <Location>London</Location>\r\n <Genre>Dystopian</Genre>\r\n <Subgenre>Political Fiction</Subgenre>\r\n </Book>\r\n </Books>"
1166
1145
  },
1167
1146
  "not_null": false,
1168
1147
  "increment": false,
@@ -1296,8 +1275,8 @@
1296
1275
  {
1297
1276
  "name": "gender",
1298
1277
  "type": {
1299
- "type_name": "nvarchar(10)",
1300
- "schemaName": null
1278
+ "type_name": "chk_gender",
1279
+ "schemaName": "dbo"
1301
1280
  },
1302
1281
  "dbdefault": null,
1303
1282
  "not_null": false,
@@ -1536,119 +1515,46 @@
1536
1515
  "value": ""
1537
1516
  }
1538
1517
  }
1539
- ],
1540
- "dbo.AddressInfo": [
1541
- {
1542
- "name": "AddressID",
1543
- "type": {
1544
- "type_name": "uniqueidentifier(16)",
1545
- "schemaName": null
1546
- },
1547
- "dbdefault": null,
1548
- "not_null": true,
1549
- "increment": false,
1550
- "note": {
1551
- "value": ""
1552
- }
1553
- },
1554
- {
1555
- "name": "AddressFormatID",
1556
- "type": {
1557
- "type_name": "uniqueidentifier(16)",
1558
- "schemaName": null
1559
- },
1560
- "dbdefault": null,
1561
- "not_null": true,
1562
- "increment": false,
1563
- "note": {
1564
- "value": ""
1565
- }
1566
- }
1567
- ],
1568
- "dbo.AddressInfo2": [
1569
- {
1570
- "name": "A1",
1571
- "type": {
1572
- "type_name": "uniqueidentifier(16)",
1573
- "schemaName": null
1518
+ ]
1519
+ },
1520
+ "enums": [
1521
+ {
1522
+ "name": "chk_status",
1523
+ "schemaName": "dbo",
1524
+ "values": [
1525
+ {
1526
+ "name": "cancelled"
1574
1527
  },
1575
- "dbdefault": null,
1576
- "not_null": true,
1577
- "increment": false,
1578
- "note": {
1579
- "value": ""
1580
- }
1581
- },
1582
- {
1583
- "name": "A2",
1584
- "type": {
1585
- "type_name": "uniqueidentifier(16)",
1586
- "schemaName": null
1528
+ {
1529
+ "name": "delivered"
1587
1530
  },
1588
- "dbdefault": null,
1589
- "not_null": true,
1590
- "increment": false,
1591
- "note": {
1592
- "value": ""
1593
- }
1594
- },
1595
- {
1596
- "name": "A3",
1597
- "type": {
1598
- "type_name": "uniqueidentifier(16)",
1599
- "schemaName": null
1531
+ {
1532
+ "name": "shipped"
1600
1533
  },
1601
- "dbdefault": null,
1602
- "not_null": true,
1603
- "increment": false,
1604
- "note": {
1605
- "value": ""
1606
- }
1607
- },
1608
- {
1609
- "name": "A4",
1610
- "type": {
1611
- "type_name": "uniqueidentifier(16)",
1612
- "schemaName": null
1534
+ {
1535
+ "name": "processing"
1613
1536
  },
1614
- "dbdefault": null,
1615
- "not_null": true,
1616
- "increment": false,
1617
- "note": {
1618
- "value": ""
1537
+ {
1538
+ "name": "pending"
1619
1539
  }
1620
- }
1621
- ],
1622
- "dbo.TestDescriptionTable": [
1623
- {
1624
- "name": "Id",
1625
- "type": {
1626
- "type_name": "int(10)",
1627
- "schemaName": null
1540
+ ]
1541
+ },
1542
+ {
1543
+ "name": "chk_gender",
1544
+ "schemaName": "dbo",
1545
+ "values": [
1546
+ {
1547
+ "name": "Other"
1628
1548
  },
1629
- "dbdefault": null,
1630
- "not_null": false,
1631
- "increment": false,
1632
- "note": {
1633
- "value": "Primary key identifier."
1634
- }
1635
- },
1636
- {
1637
- "name": "Name",
1638
- "type": {
1639
- "type_name": "nvarchar(100)",
1640
- "schemaName": null
1549
+ {
1550
+ "name": "Female"
1641
1551
  },
1642
- "dbdefault": null,
1643
- "not_null": false,
1644
- "increment": false,
1645
- "note": {
1646
- "value": "Name of the entity."
1552
+ {
1553
+ "name": "Male"
1647
1554
  }
1648
- }
1649
- ]
1650
- },
1651
- "enums": [],
1555
+ ]
1556
+ }
1557
+ ],
1652
1558
  "refs": [
1653
1559
  {
1654
1560
  "name": "FK_AuthorNationality",
@@ -1853,222 +1759,100 @@
1853
1759
  "tableConstraints": {
1854
1760
  "dbo.Authors": {
1855
1761
  "AuthorID": {
1856
- "checks": [],
1857
1762
  "pk": true
1858
1763
  },
1859
1764
  "NationalityID": {
1860
- "checks": [],
1861
1765
  "pk": true
1862
1766
  },
1863
1767
  "AuthorName": {
1864
- "checks": [],
1865
1768
  "unique": true
1866
1769
  },
1867
1770
  "BirthYear": {
1868
- "checks": [],
1869
1771
  "unique": true
1870
1772
  }
1871
1773
  },
1872
1774
  "dbo.Books": {
1873
1775
  "BookID": {
1874
- "checks": [],
1875
1776
  "pk": true
1876
1777
  },
1877
1778
  "AuthorID": {
1878
- "checks": [],
1879
1779
  "pk": true
1880
1780
  },
1881
1781
  "ISBN": {
1882
- "checks": [],
1883
1782
  "unique": true
1884
1783
  }
1885
1784
  },
1886
1785
  "dbo.DatetimeTypes": {
1887
1786
  "ID": {
1888
- "checks": [],
1889
1787
  "pk": true
1890
1788
  }
1891
1789
  },
1892
1790
  "dbo.gender_reference": {
1893
1791
  "value": {
1894
- "checks": [],
1895
1792
  "pk": true
1896
1793
  }
1897
1794
  },
1898
1795
  "dbo.NumberTypes": {
1899
1796
  "ID": {
1900
- "checks": [],
1901
1797
  "pk": true
1902
1798
  }
1903
1799
  },
1904
1800
  "dbo.NumberTypesNoDefault": {
1905
1801
  "ID": {
1906
- "checks": [],
1907
1802
  "pk": true
1908
1803
  }
1909
1804
  },
1910
1805
  "dbo.ObjectTypes": {
1911
1806
  "Id": {
1912
- "checks": [],
1913
1807
  "pk": true
1914
1808
  }
1915
1809
  },
1916
1810
  "dbo.order_items": {
1917
1811
  "order_item_id": {
1918
- "checks": [],
1919
1812
  "pk": true
1920
1813
  },
1921
1814
  "order_id": {
1922
- "checks": [],
1923
1815
  "unique": true
1924
1816
  },
1925
1817
  "product_id": {
1926
- "checks": [],
1927
1818
  "unique": true
1928
- },
1929
- "quantity": {
1930
- "checks": [
1931
- {
1932
- "name": "chk_quantity_positive",
1933
- "expression": "[quantity]>(0)"
1934
- }
1935
- ]
1936
- },
1937
- "unit_price": {
1938
- "checks": [
1939
- {
1940
- "name": "chk_unit_price_positive",
1941
- "expression": "[unit_price]>(0)"
1942
- }
1943
- ]
1944
1819
  }
1945
1820
  },
1946
1821
  "dbo.orders": {
1947
1822
  "order_id": {
1948
- "checks": [],
1949
1823
  "pk": true
1950
- },
1951
- "total_amount": {
1952
- "checks": [
1953
- {
1954
- "name": "chk_total_amount_positive",
1955
- "expression": "[total_amount]>(0)"
1956
- }
1957
- ]
1958
- },
1959
- "status": {
1960
- "checks": [
1961
- {
1962
- "name": "chk_status",
1963
- "expression": "[status]='cancelled' OR [status]='delivered' OR [status]='shipped' OR [status]='processing' OR [status]='pending'"
1964
- }
1965
- ]
1966
1824
  }
1967
1825
  },
1968
1826
  "dbo.products": {
1969
1827
  "product_id": {
1970
- "checks": [],
1971
1828
  "pk": true
1972
- },
1973
- "price": {
1974
- "checks": [
1975
- {
1976
- "name": "chk_price_positive",
1977
- "expression": "[price]>(0)"
1978
- }
1979
- ]
1980
- },
1981
- "stock_quantity": {
1982
- "checks": [
1983
- {
1984
- "name": "chk_stock_non_negative",
1985
- "expression": "[stock_quantity]>=(0)"
1986
- }
1987
- ]
1988
1829
  }
1989
1830
  },
1990
1831
  "dbo.StringTypes": {
1991
1832
  "Id": {
1992
- "checks": [],
1993
1833
  "pk": true
1994
1834
  }
1995
1835
  },
1996
1836
  "dbo.table_with_comments": {
1997
1837
  "id": {
1998
- "checks": [],
1999
1838
  "pk": true
2000
1839
  }
2001
1840
  },
2002
1841
  "dbo.user_define_data_types": {
2003
1842
  "id": {
2004
- "checks": [],
2005
1843
  "pk": true
2006
- },
2007
- "gender": {
2008
- "checks": [
2009
- {
2010
- "name": "chk_gender",
2011
- "expression": "[gender]='Other' OR [gender]='Female' OR [gender]='Male'"
2012
- }
2013
- ]
2014
1844
  }
2015
1845
  },
2016
1846
  "dbo.users": {
2017
1847
  "user_id": {
2018
- "checks": [],
2019
1848
  "pk": true
2020
1849
  },
2021
1850
  "email": {
2022
- "checks": [
2023
- {
2024
- "name": "chk_email_format",
2025
- "expression": "[email] like '%_@_%._%'"
2026
- }
2027
- ],
2028
1851
  "unique": true
2029
1852
  },
2030
1853
  "username": {
2031
- "checks": [],
2032
1854
  "unique": true
2033
- },
2034
- "date_of_birth": {
2035
- "checks": [
2036
- {
2037
- "name": "chk_age",
2038
- "expression": "[date_of_birth]<=dateadd(year,(-13),getdate())"
2039
- }
2040
- ]
2041
- }
2042
- },
2043
- "dbo.TestDescriptionTable": {
2044
- "Name": {
2045
- "checks": [
2046
- {
2047
- "name": "chk_name_len",
2048
- "expression": "len([Name])>(6)"
2049
- }
2050
- ]
2051
1855
  }
2052
1856
  }
2053
- },
2054
- "checks": {
2055
- "dbo.user_define_data_types": [
2056
- {
2057
- "name": "chk_age_range",
2058
- "expression": "[age_start]<=[age_end]"
2059
- }
2060
- ],
2061
- "dbo.AddressInfo": [
2062
- {
2063
- "name": "CK_Address_Valid",
2064
- "expression": "([AddressID]='176029FA-D6D3-49E1-A48C-000000000002' OR [AddressID]='176029FA-D6D3-49E1-A48C-000000000001') AND ([AddressFormatID]='176029FA-D6D3-49E1-A48C-000000000002' OR [AddressFormatID]='176029FA-D6D3-49E1-A48C-000000000001')"
2065
- }
2066
- ],
2067
- "dbo.AddressInfo2": [
2068
- {
2069
- "name": "CK_Address_Valid2",
2070
- "expression": "([A1]='333' OR [A1]='2222' OR [A1]='1111') AND ([A2]='2222' OR [A2]='1111') AND ([A3]='1111' OR [A3]='2222') AND ([A4]='3333' OR [A4]='2222')"
2071
- }
2072
- ]
2073
1857
  }
2074
1858
  }
@@ -1517,4 +1517,4 @@
1517
1517
  }
1518
1518
  ]
1519
1519
  }
1520
- }
1520
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "connection": "dbml/root@localhost:1521/dbml_test",
3
+ "format": "oracle"
4
+ }