2021-08-02 16:52:31 +02:00
{
"tables" : [
{
"name" : "account" ,
"columns" : [
2021-09-10 11:59:08 +02:00
{ "name" : "description" , "sqltype" : "varchar(128)" , "notnull" : true , "unique" : true , "selector" : 0 }
2021-08-02 16:52:31 +02:00
]
} ,
{
"name" : "tenant" ,
"columns" : [
{ "name" : "salutation" , "sqltype" : "varchar(128)" } ,
2021-08-28 19:00:49 +02:00
{ "name" : "firstname" , "sqltype" : "varchar(128)" , "selector" : 1 } ,
{ "name" : "lastname" , "sqltype" : "varchar(128)" , "selector" : 0 } ,
2021-08-02 16:52:31 +02:00
{ "name" : "address1" , "sqltype" : "varchar(128)" } ,
{ "name" : "address2" , "sqltype" : "varchar(128)" } ,
{ "name" : "address3" , "sqltype" : "varchar(128)" } ,
{ "name" : "zip" , "sqltype" : "varchar(10)" } ,
{ "name" : "city" , "sqltype" : "varchar(128)" } ,
{ "name" : "phone1" , "sqltype" : "varchar(64)" } ,
{ "name" : "phone2" , "sqltype" : "varchar(64)" } ,
{ "name" : "iban" , "sqltype" : "varchar(64)" } ,
2021-09-10 11:59:08 +02:00
{ "name" : "account" , "sqltype" : "integer" , "notnull" : true , "foreignkey" : true , "immutable" : true , "unique" : true }
] ,
"tableConstraints" : [
"unique(firstname, lastname)"
]
2021-08-02 16:52:31 +02:00
} ,
{
"name" : "premise" ,
"columns" : [
2021-09-10 11:59:08 +02:00
{ "name" : "description" , "sqltype" : "varchar(128)" , "selector" : 0 , "unique" : true } ,
2021-08-02 16:52:31 +02:00
{ "name" : "street" , "sqltype" : "varchar(128)" , "notnull" : true } ,
{ "name" : "zip" , "sqltype" : "varchar(10)" , "notnull" : true } ,
2021-11-08 21:04:21 +01:00
{ "name" : "city" , "sqltype" : "varchar(128)" , "notnull" : true } ,
{ "name" : "account" , "sqltype" : "integer" , "notnull" : true , "foreignkey" : true , "immutable" : true , "unique" : true }
2021-08-02 16:52:31 +02:00
]
} ,
{
"name" : "flat" ,
"columns" : [
2021-08-28 19:00:49 +02:00
{ "name" : "description" , "sqltype" : "varchar(128)" , "selector" : 1 } ,
{ "name" : "premise" , "sqltype" : "integer" , "foreignkey" : true , "selector" : 0 } ,
2021-08-02 16:52:31 +02:00
{ "name" : "area" , "sqltype" : "numeric(10,2)" , "notnull" : true } ,
{ "name" : "flat_no" , "sqltype" : "integer" }
2021-09-10 11:59:08 +02:00
] ,
"tableConstraints" : [
"unique(description, premise)"
2021-08-02 16:52:31 +02:00
]
} ,
{
"name" : "overhead_advance" ,
"columns" : [
2021-09-10 11:59:08 +02:00
{ "name" : "description" , "sqltype" : "varchar(128)" , "selector" : 0 , "unique" : true } ,
2021-09-07 15:22:55 +02:00
{ "name" : "amount" , "sqltype" : "numeric(10,4)" , "notnull" : true , "immutable" : true } ,
{ "name" : "startdate" , "sqltype" : "date" , "selector" : 1 , "immutable" : true } ,
2021-08-02 16:52:31 +02:00
{ "name" : "enddate" , "sqltype" : "date" }
]
} ,
{
"name" : "overhead_advance_flat_mapping" ,
2021-09-07 15:22:55 +02:00
"immutable" : true ,
2021-08-02 16:52:31 +02:00
"columns" : [
2021-08-28 19:00:49 +02:00
{ "name" : "overhead_advance" , "sqltype" : "integer" , "notnull" : true , "foreignkey" : true , "selector" : 0 } ,
{ "name" : "flat" , "sqltype" : "integer" , "notnull" : true , "foreignkey" : true , "selector" : 1 }
2021-08-02 16:52:31 +02:00
]
} ,
{
"name" : "parking" ,
"columns" : [
2021-08-28 19:00:49 +02:00
{ "name" : "description" , "sqltype" : "varchar(128)" , "selector" : 1 } ,
{ "name" : "premise" , "sqltype" : "integer" , "foreignkey" : true , "selector" : 0 }
2021-09-10 11:59:08 +02:00
] ,
"tableConstraints" : [
"unique(description, premise)"
2021-08-02 16:52:31 +02:00
]
} ,
{
"name" : "commercial_premise" ,
"columns" : [
2021-08-28 19:00:49 +02:00
{ "name" : "description" , "sqltype" : "varchar(128)" , "selector" : 1 } ,
{ "name" : "premise" , "sqltype" : "integer" , "foreignkey" : true , "selector" : 0 }
2021-09-10 11:59:08 +02:00
] ,
"tableConstraints" : [
"unique(description, premise)"
2021-08-02 16:52:31 +02:00
]
} ,
{
"name" : "tenancy" ,
"columns" : [
2021-09-10 11:59:08 +02:00
{ "name" : "description" , "sqltype" : "varchar(128)" , "selector" : 0 , "unique" : true } ,
2021-09-07 15:22:55 +02:00
{ "name" : "tenant" , "sqltype" : "integer" , "notnull" : true , "foreignkey" : true , "immutable" : true } ,
{ "name" : "flat" , "sqltype" : "integer" , "notnull" : false , "foreignkey" : true , "immutable" : true } ,
{ "name" : "parking" , "sqltype" : "integer" , "notnull" : false , "foreignkey" : true , "immutable" : true } ,
{ "name" : "commercial_premise" , "sqltype" : "integer" , "notnull" : false , "foreignkey" : true , "immutable" : true } ,
{ "name" : "startdate" , "sqltype" : "date" , "notnull" : true , "selector" : 1 , "immutable" : true } ,
2021-08-02 16:52:31 +02:00
{ "name" : "enddate" , "sqltype" : "date" , "notnull" : false }
] ,
"tableConstraints" : [
2021-09-10 11:59:08 +02:00
"check ((flat is not null and parking is null and commercial_premise is null) or (flat is null and parking is not null and commercial_premise is null) or (flat is null and parking is null and commercial_premise is not null))" ,
"unique(flat, parking, commercial_premise, startdate)"
2021-08-02 16:52:31 +02:00
]
} ,
{
"name" : "fee" ,
"columns" : [
2021-09-10 11:59:08 +02:00
{ "name" : "description" , "sqltype" : "varchar(128)" , "selector" : 0 , "unique" : true } ,
2021-09-07 15:22:55 +02:00
{ "name" : "amount" , "sqltype" : "numeric(10,2)" , "notnull" : true , "immutable" : true } ,
{ "name" : "fee_type" , "sqltype" : "varchar(10)" , "notnull" : true , "immutable" : true } ,
{ "name" : "startdate" , "sqltype" : "date" , "selector" : 1 , "immutable" : true } ,
2021-08-02 16:52:31 +02:00
{ "name" : "enddate" , "sqltype" : "date" }
] ,
"tableConstraints" : [
2021-09-10 11:59:08 +02:00
"check (fee_type = 'per_area' or fee_type = 'total')"
2021-08-02 16:52:31 +02:00
]
} ,
{
"name" : "tenancy_fee_mapping" ,
2021-09-07 15:22:55 +02:00
"immutable" : true ,
2021-08-02 16:52:31 +02:00
"columns" : [
{ "name" : "tenancy" , "sqltype" : "integer" , "notnull" : true , "foreignkey" : true } ,
{ "name" : "fee" , "sqltype" : "integer" , "notnull" : true , "foreignkey" : true }
]
} ,
2021-09-10 11:59:08 +02:00
{
"name" : "account_entry_category" ,
"immutable" : true ,
"columns" : [
{ "name" : "description" , "sqltype" : "varchar(128)" , "notnull" : true , "selector" : 0 , "unique" : true } ,
{ "name" : "overhead_relevant" , "sqltype" : "boolean" , "notnull" : true , "default" : "true" }
]
} ,
2021-08-02 16:52:31 +02:00
{
"name" : "account_entry" ,
2021-09-07 15:22:55 +02:00
"immutable" : true ,
2021-08-02 16:52:31 +02:00
"columns" : [
2021-09-14 13:38:27 +02:00
{ "name" : "description" , "sqltype" : "varchar(1024)" , "notnull" : true } ,
2021-08-02 16:52:31 +02:00
{ "name" : "account" , "sqltype" : "integer" , "notnull" : true , "foreignkey" : true } ,
2022-01-06 21:06:16 +01:00
{ "name" : "created_at" , "sqltype" : "timestamp" , "notnull" : true , "default" : "now()" , "selector" : 0 } ,
{ "name" : "due_at" , "sqltype" : "timestamp" , "notnull" : false } ,
{ "name" : "amount" , "sqltype" : "numeric(10,2)" , "notnull" : true } ,
2021-11-08 21:04:21 +01:00
{ "name" : "document_no" , "sqltype" : "integer" , "unique" : true } ,
2021-09-10 11:59:08 +02:00
{ "name" : "account_entry_category" , "sqltype" : "integer" , "notnull" : true , "foreignkey" : true }
] ,
"tableConstraints" : [
"unique(description, account, created_at)"
2021-08-02 16:52:31 +02:00
]
2021-09-09 18:39:18 +02:00
} ,
{
"name" : "note" ,
"immutable" : true ,
"columns" : [
2022-01-06 21:06:16 +01:00
{ "name" : "created_at" , "sqltype" : "timestamp" , "notnull" : true , "default" : "now()" , "selector" : 0 } ,
2021-09-09 18:39:18 +02:00
{ "name" : "tenant" , "sqltype" : "integer" , "notnull" : true , "foreignkey" : true } ,
{ "name" : "note" , "sqltype" : "varchar(4096)" , "notnull" : true }
]
2021-08-02 16:52:31 +02:00
}
]
}