survey added

This commit is contained in:
ycc 2022-04-20 15:22:31 +02:00
parent dee183ae76
commit c9614975a6
20 changed files with 386 additions and 5 deletions

6
gen/computer.html Normal file
View File

@ -0,0 +1,6 @@
computer
description : varchar(1000)
id : integer
name : varchar(255)|comment
os : varchar(255)
}

6
gen/dbentity.html Normal file
View File

@ -0,0 +1,6 @@
dbentity
description : text
id : integer
parent_id : bigint
type : varchar(255)
}

5
gen/dbrole.html Normal file
View File

@ -0,0 +1,5 @@
dbrole
description : text
id : integer
name : varchar
}

6
gen/dbtableaccess.html Normal file
View File

@ -0,0 +1,6 @@
dbtableaccess
dbrole_id : integer
id : integer
tableaccess : varchar(255)
userrolerestrictions : varchar(255)
}

5
gen/dbuser.html Normal file
View File

@ -0,0 +1,5 @@
dbuser
id : integer
login : varchar(255)|comment
password : varchar(255)
}

8
gen/dbuserrole.html Normal file
View File

@ -0,0 +1,8 @@
dbuserrole
dbentity_id : integer
dbrole_id : integer
dbuser_id : integer
enddate : timestamp without time zone
id : integer
startdate : timestamp without time zone
}

7
gen/entity.html Normal file
View File

@ -0,0 +1,7 @@
entity
enddate : date
id : integer
name : varchar(255)
startdate : date
type : varchar(255)
}

7
gen/person.html Normal file
View File

@ -0,0 +1,7 @@
person
email : varchar(255)
firstname : varchar(255)
id : integer
mobile : varchar(255)
name : varchar(255)
}

8
gen/software.html Normal file
View File

@ -0,0 +1,8 @@
software
company : varchar(255)
description : varchar(1000)
id : integer
licenseend : date
name : varchar(255)|comment
support : varchar(255)
}

View File

@ -0,0 +1,5 @@
software_computer
computer_id : integer
id : integer
software_id : integer
}

13
gen/test.html Normal file
View File

@ -0,0 +1,13 @@
test
description : varchar(1000)
enddate : timestamp without time zone
floatvalue : double precision
id : integer
intvalue : integer
latitude : double precision|map
longitude : double precision|map
name : varchar(255)|comment
price : money
startdate : timestamp without time zone
testtype_id : integer
}

5
gen/testtype.html Normal file
View File

@ -0,0 +1,5 @@
testtype
detail : varchar(255)
id : integer
name : varchar(255)
}

8
gen/timetracking.html Normal file
View File

@ -0,0 +1,8 @@
timetracking
afternoon_entity_id : integer
comment : varchar(255)
day : date
id : integer
morning_entity_id : integer
person_id : integer
}

4
go.mod
View File

@ -1,5 +1,5 @@
module forge.redroom.link/yves/sqldb
go 1.15
go 1.17
require github.com/lib/pq v1.10.3
require github.com/lib/pq v1.10.4

4
go.sum
View File

@ -1,2 +1,2 @@
github.com/lib/pq v1.10.3 h1:v9QZf2Sn6AmjXtQeFpdoq/eaNtYP6IN+7lcrygsIAtg=
github.com/lib/pq v1.10.3/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/lib/pq v1.10.4 h1:SO9z7FRPzA03QhHKJrH5BXA6HU1rS4V2nIVrrNC1iYk=
github.com/lib/pq v1.10.4/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=

View File

@ -61,6 +61,7 @@
"day":"date",
"morning_entity_id":"integer",
"afternoon_entity_id":"integer",
"person_id":"integer",
"comment":"varchar(255)"
}
}

1
pg.go
View File

@ -447,6 +447,7 @@ func (db *Db) SaveSchema(generatedFilename string) error {
log.Println(err)
return err
}
// file, _ := json.Marshal(schema)
file, _ := json.MarshalIndent(schema, "", " ")
_ = ioutil.WriteFile(generatedFilename, file, 0644)
return nil

156
schema.json Normal file
View File

@ -0,0 +1,156 @@
[
{
"name": "computer",
"columns": {
"description": "varchar(1000)",
"id": "integer",
"name": "varchar(255)|comment",
"os": "varchar(255)"
}
},
{
"name": "dbentity",
"columns": {
"description": "text",
"id": "integer",
"parent_id": "bigint",
"type": "varchar(255)"
}
},
{
"name": "dbrole",
"columns": {
"description": "text",
"id": "integer",
"name": "varchar"
}
},
{
"name": "dbtableaccess",
"columns": {
"dbrole_id": "integer",
"id": "integer",
"tableaccess": "varchar(255)",
"userrolerestrictions": "varchar(255)"
}
},
{
"name": "dbuser",
"columns": {
"id": "integer",
"login": "varchar(255)|comment",
"password": "varchar(255)"
}
},
{
"name": "dbuserrole",
"columns": {
"dbentity_id": "integer",
"dbrole_id": "integer",
"dbuser_id": "integer",
"enddate": "timestamp without time zone",
"id": "integer",
"startdate": "timestamp without time zone"
}
},
{
"name": "entity",
"columns": {
"enddate": "date",
"id": "integer",
"name": "varchar(255)",
"startdate": "date",
"type": "varchar(255)"
}
},
{
"name": "person",
"columns": {
"email": "varchar(255)",
"firstname": "varchar(255)",
"id": "integer",
"mobile": "varchar(255)",
"name": "varchar(255)"
}
},
{
"name": "software",
"columns": {
"company": "varchar(255)",
"description": "varchar(1000)",
"id": "integer",
"licenseend": "date",
"name": "varchar(255)|comment",
"support": "varchar(255)"
}
},
{
"name": "software_computer",
"columns": {
"computer_id": "integer",
"id": "integer",
"software_id": "integer"
}
},
{
"name": "test",
"columns": {
"description": "varchar(1000)",
"enddate": "timestamp without time zone",
"floatvalue": "double precision",
"id": "integer",
"intvalue": "integer",
"latitude": "double precision|map",
"longitude": "double precision|map",
"name": "varchar(255)|comment",
"price": "money",
"startdate": "timestamp without time zone",
"testtype_id": "integer"
}
},
{
"name": "testtype",
"columns": {
"detail": "varchar(255)",
"id": "integer",
"name": "varchar(255)"
}
},
{
"name": "timetracking",
"columns": {
"afternoon_entity_id": "integer",
"comment": "varchar(255)",
"day": "date",
"id": "integer",
"morning_entity_id": "integer"
}
},
{
"name": "surveyquestion",
"columns": {
"type": "integer",
"label": "varchar(1000)",
"responses": "varchar(1000)",
"id": "integer",
"votes": "integer"
}
},
{
"name": "surveyresponse",
"columns": {
"surveyuser_id": "integer",
"surveyquestion_id": "varchar(255)",
"response": "varchar(1000)",
"id": "integer"
}
},
{
"name": "surveyuser",
"columns": {
"voted": "bool",
"code": "varchar(255)",
"id": "integer"
}
}
]

132
schema.puml Normal file
View File

@ -0,0 +1,132 @@
@startuml
entity computer {
description : varchar(1000)
id : integer
name : varchar(255)|comment
os : varchar(255)
}
entity dbentity {
description : text
id : integer
parent_id : bigint
type : varchar(255)
}
entity dbrole {
description : text
id : integer
name : varchar
}
entity dbtableaccess {
dbrole_id : integer
id : integer
tableaccess : varchar(255)
userrolerestrictions : varchar(255)
}
entity dbuser {
id : integer
login : varchar(255)|comment
password : varchar(255)
}
entity dbuserrole {
dbentity_id : integer
dbrole_id : integer
dbuser_id : integer
enddate : timestamp without time zone
id : integer
startdate : timestamp without time zone
}
entity entity {
enddate : date
id : integer
name : varchar(255)
startdate : date
type : varchar(255)
}
entity person {
email : varchar(255)
firstname : varchar(255)
id : integer
mobile : varchar(255)
name : varchar(255)
}
entity software {
company : varchar(255)
description : varchar(1000)
id : integer
licenseend : date
name : varchar(255)|comment
support : varchar(255)
}
entity software_computer {
computer_id : integer
id : integer
software_id : integer
}
entity test {
description : varchar(1000)
enddate : timestamp without time zone
floatvalue : double precision
id : integer
intvalue : integer
latitude : double precision|map
longitude : double precision|map
name : varchar(255)|comment
price : money
startdate : timestamp without time zone
testtype_id : integer
}
entity testtype {
detail : varchar(255)
id : integer
name : varchar(255)
}
entity timetracking {
afternoon_entity_id : integer
comment : varchar(255)
day : date
id : integer
morning_entity_id : integer
person_id : integer
}
dbentity ||..|| parent
dbtableaccess ||..|| dbrole
dbuserrole ||..|| dbentity
dbuserrole ||..|| dbrole
dbuserrole ||..|| dbuser
software_computer ||..|| computer
software_computer ||..|| software
test ||..|| testtype
timetracking ||..|| entity
timetracking ||..|| person
timetracking ||..|| entity
@enduml

View File

@ -1 +1,3 @@
{{.Name}}
{{range $key, $value := .Columns}} {{$key}} : {{$value}}
{{end}}