Skip to content

Commit f3e64ec

Browse files
committed
cleanup for potential merge
1 parent fc2801f commit f3e64ec

File tree

8 files changed

+7
-214
lines changed

8 files changed

+7
-214
lines changed

config.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,4 @@ static: # This allows static files to be directly accessible
1414
roles: # This can define the roles that are used in the application
1515
files: roles.yaml
1616
dataLoader: # This loads data into user tables from YAML or JSON files
17-
files: data/*.{json,yaml,yml}
18-
# forceLoad: true # Uncomment to force loading data even if tables already have records
17+
files: data/*.{json,yaml,yml}

data/README.md

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Data files must contain `table` and `records` fields. The `database` field is op
1717

1818
### JSON Example
1919

20-
```json
20+
```jsonc
2121
{
2222
"database": "dev", // Optional - uses default database if omitted
2323
"table": "Product", // Required - name of the table
@@ -45,11 +45,13 @@ records: # Required - array of records
4545
## Key Features
4646
4747
- **Automatic Table Creation**: Tables are created if they don't exist
48-
- **Primary Key Detection**: The `id` field is automatically detected as the primary key
48+
- **Schema Inference**:
49+
- The system will automatically infer a schema from the first record when creating a new table
50+
- The `id` field is automatically detected as the primary key
51+
- It's preferred to define the schema explicitly in your application, but this provides a quick start
4952
- **File Modification Time**:
5053
- The data loader uses the file's modification time (`mtime`) to determine if records should be updated
5154
- "Touching" a file (updating its modification time) will force a reload of its data
52-
- This allows for simpler data files without timestamp properties in the records
5355
- **Multi-file Support**: You can have multiple data files for different tables
5456
- **Complex Data Types**: Supports nested objects, arrays, and various data types
5557
- **One Table Per File**: Each file should define one table
@@ -62,12 +64,4 @@ records: # Required - array of records
6264
touch data/products.json
6365
```
6466
- If you need to restore to previous data, you can replace the file and update its timestamp
65-
- The system automatically handles the comparison between file modification time and record timestamps
66-
67-
## Sample Files
68-
69-
- `categories.json`: Category data with parent/child relationships
70-
- `products.json`: Product data with references to categories
71-
- `users.json`: User account data
72-
73-
These sample files demonstrate common data patterns and relationships.
67+
- The system automatically handles the comparison between file modification time and record timestamps

data/categories.json

Lines changed: 0 additions & 26 deletions
This file was deleted.

data/products.json

Lines changed: 0 additions & 37 deletions
This file was deleted.

data/sample-data.yaml

Lines changed: 0 additions & 63 deletions
This file was deleted.

data/users-myco.json

Lines changed: 0 additions & 20 deletions
This file was deleted.

data/users.json

Lines changed: 0 additions & 19 deletions
This file was deleted.

schema.graphql

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -8,38 +8,3 @@ type TableName @table @export {
88
name: String # we can define any other attributes here
99
tag: String @indexed # we can specify any attributes that should be indexed
1010
}
11-
12-
## Example tables for data loader example
13-
type Product @table @export {
14-
id: ID @primaryKey
15-
name: String @indexed
16-
price: Float
17-
category: Category @relationship(from: categoryId)
18-
details: Any
19-
inStock: Boolean
20-
}
21-
22-
type Category @table @export {
23-
id: ID @primaryKey
24-
name: String @indexed
25-
description: String
26-
parent: Category @relationship(from: categoryId)
27-
products: [Product] @relationship(to: categoryId)
28-
children: [Category] @relationship(to: categoryId)
29-
}
30-
31-
type User @table @export {
32-
id: ID @primaryKey
33-
username: String @indexed
34-
email: String @indexed
35-
firstName: String
36-
lastName: String
37-
}
38-
39-
type MycoUser @table(database: "myco", table: "User") @export {
40-
id: ID @primaryKey
41-
username: String @indexed
42-
email: String @indexed
43-
firstName: String
44-
lastName: String
45-
}

0 commit comments

Comments
 (0)