Skip to content

Commit 60d672a

Browse files
committed
Support JSON as strings
1 parent 8cfe7cb commit 60d672a

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ These features match features in v1 (see branch "v1"):
104104
- [x] Supports POST variables as input (x-www-form-urlencoded)
105105
- [x] Supports a JSON object as input
106106
- [x] Supports a JSON array as input (batch insert)
107-
- [ ] Supports file upload from web forms (multipart/form-data)
107+
- [x] Supports file upload from web forms (multipart/form-data)
108108
- [ ] ~~Condensed JSON output: first row contains field names~~
109109
- [x] Sanitize and validate input using callbacks
110110
- [x] Permission system for databases, tables, columns and records
@@ -118,7 +118,7 @@ These features match features in v1 (see branch "v1"):
118118
- [x] Atomic increment support via PATCH (for counters)
119119
- [x] Binary fields supported with base64 encoding
120120
- [x] Spatial/GIS fields and filters supported with WKT
121-
- [ ] Unstructured data support through JSON/JSONB
121+
- [ ] ~~Unstructured data support through JSON/JSONB~~
122122
- [x] Generate API documentation using OpenAPI tools
123123
- [x] Authentication via JWT token or username/password
124124
- [ ] ~~SQLite support~~

api.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2621,6 +2621,7 @@ public function __construct(String $driver)
26212621
'point' => 'geometry',
26222622
'datetime' => 'timestamp',
26232623
'enum' => 'varchar',
2624+
'json' => 'clob',
26242625
],
26252626
'pgsql' => [
26262627
'bigserial' => 'bigint',
@@ -2633,6 +2634,7 @@ public function __construct(String $driver)
26332634
'circle' => 'geometry',
26342635
'double precision' => 'double',
26352636
'inet' => 'integer',
2637+
'json' => 'clob',
26362638
'jsonb' => 'clob',
26372639
'line' => 'geometry',
26382640
'lseg' => 'geometry',

src/Tqdev/PhpCrudApi/Database/TypeConverter.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ public function __construct(String $driver)
6262
'point' => 'geometry',
6363
'datetime' => 'timestamp',
6464
'enum' => 'varchar',
65+
'json' => 'clob',
6566
],
6667
'pgsql' => [
6768
'bigserial' => 'bigint',
@@ -75,6 +76,7 @@ public function __construct(String $driver)
7576
'double precision' => 'double',
7677
'inet' => 'integer',
7778
//'interval [ fields ]'
79+
'json' => 'clob',
7880
'jsonb' => 'clob',
7981
'line' => 'geometry',
8082
'lseg' => 'geometry',

tests/fixtures/blog_mysql.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ CREATE TABLE `products` (
125125
`id` int(11) NOT NULL AUTO_INCREMENT,
126126
`name` varchar(255) NOT NULL,
127127
`price` decimal(10,2) NOT NULL,
128-
`properties` LONGTEXT NOT NULL,
128+
`properties` JSON NOT NULL,
129129
`created_at` datetime NOT NULL,
130130
`deleted_at` datetime NULL,
131131
PRIMARY KEY (`id`)

0 commit comments

Comments
 (0)