air-dml 2.1.9 → 2.1.11
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/README.md +69 -16
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -49,7 +49,7 @@ import { parseAirDML, exportToAirDML } from 'air-dml';
|
|
|
49
49
|
// Parse AIR-DML text
|
|
50
50
|
const airDmlText = `
|
|
51
51
|
Project "My Project" {
|
|
52
|
-
database_type:
|
|
52
|
+
database_type: "PostgreSQL"
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
// ユーザー管理
|
|
@@ -120,8 +120,26 @@ Table table_name [alias: "論理名", pos_x: 100, pos_y: 200, color: "#1976D2"]
|
|
|
120
120
|
| `unique` | Unique constraint | `email varchar [unique]` |
|
|
121
121
|
| `not null` | NOT NULL constraint | `name varchar [not null]` |
|
|
122
122
|
| `increment` | Auto increment | `id integer [pk, increment]` |
|
|
123
|
+
| `hidden` | Hide column in canvas | `MANDT varchar [hidden]` |
|
|
123
124
|
| `alias: "name"` | Logical name | `[alias: "ユーザーID"]` |
|
|
124
125
|
| `note: "desc"` | Column description | `[note: "説明"]` |
|
|
126
|
+
| `values: "k=v/..."` | Enum / classification values | `[values: "1=有効/2=無効"]` |
|
|
127
|
+
| `default: "val"` | Default value | `[default: "active"]` |
|
|
128
|
+
|
|
129
|
+
#### `values:` — Enum / Classification Values
|
|
130
|
+
|
|
131
|
+
Define allowed values for a column (status codes, flags, etc.):
|
|
132
|
+
|
|
133
|
+
```dbml
|
|
134
|
+
status varchar(1) [
|
|
135
|
+
not null,
|
|
136
|
+
alias: "ステータス",
|
|
137
|
+
values: "1=有効/2=無効/3=削除済",
|
|
138
|
+
default: "1"
|
|
139
|
+
]
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Format: `"key=label/key2=label2/..."` — key and label separated by `=`, entries separated by `/`.
|
|
125
143
|
|
|
126
144
|
### Relationships
|
|
127
145
|
|
|
@@ -176,7 +194,7 @@ Table subscriptions [alias: "定期購入"] {
|
|
|
176
194
|
id serial [pk, alias: "定期購入ID"]
|
|
177
195
|
user_id integer [fk, not null, alias: "ユーザーID"]
|
|
178
196
|
product_id integer [fk, not null, alias: "商品ID"]
|
|
179
|
-
status
|
|
197
|
+
status varchar(1) [not null, alias: "ステータス", values: "1=有効/2=停止/3=解約", default: "1"]
|
|
180
198
|
created_at timestamp [not null, alias: "作成日時"]
|
|
181
199
|
}
|
|
182
200
|
|
|
@@ -184,6 +202,9 @@ Ref: subscriptions.user_id > users.id
|
|
|
184
202
|
Ref: subscriptions.product_id > products.id
|
|
185
203
|
```
|
|
186
204
|
|
|
205
|
+
**Use `values:` for any column with a fixed set of allowed values** (status, type, flag, etc.).
|
|
206
|
+
Format: `"key=label/key2=label2/..."` with `/` separator.
|
|
207
|
+
|
|
187
208
|
For complete AI generation guidelines, see [SPECIFICATION.md Section 5](./SPECIFICATION.md#5-ai生成時のガイドライン).
|
|
188
209
|
|
|
189
210
|
## API Reference
|
|
@@ -207,6 +228,22 @@ Export a Diagram object to AIR-DML text.
|
|
|
207
228
|
|
|
208
229
|
**Returns:** AIR-DML formatted text
|
|
209
230
|
|
|
231
|
+
### `getDataTypesForDatabase(database: string): string[]`
|
|
232
|
+
|
|
233
|
+
Get the list of supported data types for a specific database.
|
|
234
|
+
|
|
235
|
+
**Parameters:**
|
|
236
|
+
- `database` - Database name: `"PostgreSQL"` | `"MySQL"` | `"SQLite"` | `"SQL Server"` | `"Oracle"` | `"BigQuery"` | `"Redshift"` | `"Snowflake"`
|
|
237
|
+
|
|
238
|
+
**Returns:** Array of data type strings
|
|
239
|
+
|
|
240
|
+
```typescript
|
|
241
|
+
import { getDataTypesForDatabase } from 'air-dml';
|
|
242
|
+
|
|
243
|
+
const types = getDataTypesForDatabase('PostgreSQL');
|
|
244
|
+
// ["integer", "bigint", "varchar", "text", "boolean", "timestamp", ...]
|
|
245
|
+
```
|
|
246
|
+
|
|
210
247
|
## Type Definitions
|
|
211
248
|
|
|
212
249
|
```typescript
|
|
@@ -245,7 +282,10 @@ interface Column {
|
|
|
245
282
|
unique?: boolean;
|
|
246
283
|
notNull?: boolean;
|
|
247
284
|
increment?: boolean;
|
|
285
|
+
hidden?: boolean; // v2.1.8+
|
|
248
286
|
note?: string;
|
|
287
|
+
values?: string; // v2.1.9+ — "key=label/key2=label2/..."
|
|
288
|
+
defaultValue?: string; // v2.1.9+
|
|
249
289
|
leadingComments?: string[]; // v1.2.0+
|
|
250
290
|
}
|
|
251
291
|
|
|
@@ -291,30 +331,43 @@ interface Area {
|
|
|
291
331
|
|
|
292
332
|
## Changelog
|
|
293
333
|
|
|
334
|
+
### v2.1.9 (2026-04)
|
|
335
|
+
- Added `values: "key=label/..."` column attribute for enum/classification values
|
|
336
|
+
- Added `default: "value"` column attribute (redesigned with double-quote consistency)
|
|
337
|
+
- SAP R/3 namespace support: `/NAMESPACE/FIELDNAME` identifiers in lexer
|
|
338
|
+
|
|
339
|
+
### v2.1.8 (2026-04)
|
|
340
|
+
- Added `hidden` column attribute to hide columns from canvas display
|
|
341
|
+
|
|
342
|
+
### v2.1.7 (2026-04)
|
|
343
|
+
- Fixed: attribute keywords (`alias`, `note`, etc.) now usable as column names
|
|
344
|
+
|
|
345
|
+
### v2.1.6 (2026-03)
|
|
346
|
+
- Fixed: top-level keywords (`project`, `table`, `ref`, `area`) now usable as column names
|
|
347
|
+
|
|
348
|
+
### v2.1.5 (2026-03)
|
|
349
|
+
- Fixed: multi-word type names (e.g. `timestamp with time zone`) correctly quoted in export
|
|
350
|
+
|
|
351
|
+
### v2.1.4 (2026-03)
|
|
352
|
+
- Added SQL standard type names to PostgreSQL (character varying, time with time zone, etc.)
|
|
353
|
+
|
|
354
|
+
### v2.1.3 (2026-03)
|
|
355
|
+
- Expanded data type lists for all 8 databases (PostgreSQL, MySQL, Oracle, SQL Server, SQLite, BigQuery, Redshift, Snowflake)
|
|
356
|
+
|
|
357
|
+
### v2.1.2 (2026-03)
|
|
358
|
+
- Added Snowflake database type support
|
|
359
|
+
|
|
294
360
|
### v2.1.0 (2025-01)
|
|
295
|
-
- **Breaking**: Removed `default` column constraint
|
|
296
|
-
- Simplified parser by removing inconsistent quote handling for default values
|
|
361
|
+
- **Breaking**: Removed `default` column constraint (re-added in v2.1.9 with double-quote consistency)
|
|
297
362
|
|
|
298
363
|
### v2.0.0 (2025-01)
|
|
299
364
|
- **Major**: Replaced `@dbml/core` dependency with custom hand-written recursive descent parser
|
|
300
365
|
- Full AIR-DML syntax support without external dependencies
|
|
301
366
|
- Improved error messages in Japanese
|
|
302
|
-
- Better handling of Japanese identifiers and comments
|
|
303
|
-
|
|
304
|
-
### v1.2.3 (2025-01)
|
|
305
|
-
- Bug fixes for Area parsing with Japanese names
|
|
306
|
-
- Improved comment preservation
|
|
307
|
-
- Added AI generation guidelines to specification
|
|
308
367
|
|
|
309
368
|
### v1.2.0 (2025-01)
|
|
310
369
|
- Added leading comment preservation for Tables, References, and Areas
|
|
311
370
|
- Added `leadingComments` field to type definitions
|
|
312
|
-
- Export comments back to AIR-DML format
|
|
313
|
-
|
|
314
|
-
### v1.1.0 (2025-01)
|
|
315
|
-
- Added `labelHorizontal` and `labelVertical` attributes for Areas
|
|
316
|
-
- Added `swapEdge` attribute for References
|
|
317
|
-
- Improved Area attribute parsing
|
|
318
371
|
|
|
319
372
|
### v1.0.0 (2025-01)
|
|
320
373
|
- Initial release
|