@rdbms-erd/core 0.1.2 → 0.1.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rdbms-erd/core",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "license": "MIT",
5
5
  "keywords": [
6
6
  "erd",
@@ -1,5 +1,12 @@
1
1
  import { describe, expect, it } from "vitest";
2
- import { applyLogicalTypeChange, convertDesignDialect, createColumn, createEmptyDesign, defaultPhysicalType } from "../index";
2
+ import {
3
+ applyLogicalTypeChange,
4
+ convertDesignDialect,
5
+ createColumn,
6
+ createEmptyDesign,
7
+ defaultPhysicalType,
8
+ inferLogicalTypeFromPhysical,
9
+ } from "../index";
3
10
 
4
11
  describe("logical / physical types", () => {
5
12
  it("createColumn defaults physical name to logical name and sets default physical type", () => {
@@ -91,4 +98,13 @@ describe("logical / physical types", () => {
91
98
  expect(defaultPhysicalType("sqlite", "BINARY")).toBe("BLOB");
92
99
  expect(defaultPhysicalType("mssql", "DECIMAL")).toBe("DECIMAL(10,2)");
93
100
  });
101
+
102
+ it("inferLogicalTypeFromPhysical maps defaults and common aliases", () => {
103
+ expect(inferLogicalTypeFromPhysical("mssql", "INT")).toBe("NUMBER");
104
+ expect(inferLogicalTypeFromPhysical("mssql", "NVARCHAR(500)")).toBe("TEXT");
105
+ expect(inferLogicalTypeFromPhysical("mssql", "DATETIME2")).toBe("DATETIME");
106
+ expect(inferLogicalTypeFromPhysical("mssql", "BIT")).toBe("BOOLEAN");
107
+ expect(inferLogicalTypeFromPhysical("postgres", "INTEGER")).toBe("NUMBER");
108
+ expect(inferLogicalTypeFromPhysical("postgres", "VARCHAR(255)")).toBe("TEXT");
109
+ });
94
110
  });