use sequence per tenant
This commit is contained in:
parent
0c9313b77c
commit
d51c8c7547
17
api.http
17
api.http
@ -7,8 +7,7 @@ Authorization: {{auth-token}}
|
|||||||
"data": {
|
"data": {
|
||||||
"number": "KA01HD6677",
|
"number": "KA01HD6677",
|
||||||
"owner": "gowthaman"
|
"owner": "gowthaman"
|
||||||
},
|
}
|
||||||
"uniqueIdentifier": "KA01HD6677"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
### create row
|
### create row
|
||||||
@ -55,17 +54,6 @@ Authorization: Bearer {{auth-token}}
|
|||||||
GET http://localhost:9001/api/vehicle/KA01HD6677
|
GET http://localhost:9001/api/vehicle/KA01HD6677
|
||||||
Authorization: Bearer {{auth-token}}
|
Authorization: Bearer {{auth-token}}
|
||||||
|
|
||||||
### query row
|
|
||||||
POST http://localhost:9001/api/vehicle/query
|
|
||||||
Content-Type: application/json
|
|
||||||
Authorization: {{set-auth-token}}
|
|
||||||
|
|
||||||
{
|
|
||||||
"sql": "select sys_pk, tenant_id, deleted_on, deleted_by, deleted, version, created_at, modified_at, created_by, modified_by, data, tags, comments, unique_identifier, entity_name from data_model where data ->> 'number' = :number",
|
|
||||||
"params": {
|
|
||||||
"number": "KA03HD6064"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
### search row
|
### search row
|
||||||
POST http://localhost:9001/api/vehicle/search
|
POST http://localhost:9001/api/vehicle/search
|
||||||
@ -73,7 +61,8 @@ Content-Type: application/json
|
|||||||
Authorization: {{auth-token}}
|
Authorization: {{auth-token}}
|
||||||
|
|
||||||
{
|
{
|
||||||
"number": "KA01HD6677"
|
"number": "KA01HD6677",
|
||||||
|
"owner": "gowthaman"
|
||||||
}
|
}
|
||||||
|
|
||||||
### update field
|
### update field
|
||||||
|
|||||||
@ -206,7 +206,8 @@ object Session {
|
|||||||
.findOne() ?: throw DataNotFoundException
|
.findOne() ?: throw DataNotFoundException
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun seqName(entity: String) = "sequence_$entity"
|
private fun seqName(entity: String) = "sequence_${entity}_${currentTenant()}"
|
||||||
|
|
||||||
fun creatSeq(entity: String): Int {
|
fun creatSeq(entity: String): Int {
|
||||||
return database.sqlUpdate("CREATE SEQUENCE IF NOT EXISTS ${seqName(entity)} START 1;").execute()
|
return database.sqlUpdate("CREATE SEQUENCE IF NOT EXISTS ${seqName(entity)} START 1;").execute()
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user