vault backup: 2025-03-30 00:43:42

Affected files:
.obsidian/workspace.json
Management/Development and Configuration/Datapack/Database.md
This commit is contained in:
ehrumsey 2025-03-30 00:43:42 -05:00
parent 12e9ea910d
commit a3b50edf45
2 changed files with 53 additions and 3 deletions

View File

@ -97,12 +97,12 @@
"state": { "state": {
"type": "markdown", "type": "markdown",
"state": { "state": {
"file": "Management/Development and Configuration/Datapack/Logging.md", "file": "Management/Development and Configuration/Datapack/Database.md",
"mode": "source", "mode": "source",
"source": false "source": false
}, },
"icon": "lucide-file", "icon": "lucide-file",
"title": "Logging" "title": "Database"
} }
} }
], ],
@ -266,8 +266,9 @@
}, },
"active": "f26c718e97d69090", "active": "f26c718e97d69090",
"lastOpenFiles": [ "lastOpenFiles": [
"Management/Development and Configuration/Untitled.md",
"Management/Development and Configuration/Datapack/Logging.md", "Management/Development and Configuration/Datapack/Logging.md",
"Management/Development and Configuration/Datapack/Database.md",
"Management/Development and Configuration/Untitled.md",
"Management/Development and Configuration/index.md", "Management/Development and Configuration/index.md",
"Untitled.md", "Untitled.md",
"Management/User and Admin/Crafty Controller.md", "Management/User and Admin/Crafty Controller.md",

View File

@ -0,0 +1,49 @@
---
title: Database
draft: "false"
---
# Creating a Schema
```ts
@add(this.schema)
function tables.myTable() {
createTable(myTable, name);
createField(myTable, id, int, [pk, un]);
createField(myTable, name, string, [fk, un]);
createField(myTable, description, string, []);
finishTable(myTable); // Runs checks, such as existence of pk
}
```
# Data Structure
```json
{
database: {
tables: {
$table: {
name: string, // $name
fields: string[], // $field
pk: string, // $field
fk: string[], // $field (optional)
un: string[], // $field
rq: string[], // $filed (optional)
data: {
$field: {
name: string, // $field
type: string, // $type
props: { // these are parsed from props array
pk: bool,
fk: bool,
un: bool,
rq: bool,
},
content: any[]
}
...
}
}
...
}
}
}
```