Commit Graph

9 Commits

Author SHA1 Message Date
Gibheer 9de4163d22 fix the modified_by and modified_at columns
As all changes are already written into history, why not enforce the
proper changing of modified_at and modified_by columns?

This way we can be sure these are properly changed and don't have to
take care of that in the SQL statements anymore.
2021-05-21 21:07:08 +02:00
Gibheer f28b0d0ae3 fix not null constraint
The default not null constraint only checks for the SQL null, not a json
null.
Therefore add an extended not null constraint by checking both possible
null values.
2021-05-21 20:53:50 +02:00
Gibheer d746ad7ac0 add function to get subnets to schema
This also adds a view to get a list of all containers and their free
space in between.
This is needed for ippool_list to get a nice overview over everything.

The code of the function is based on
https://pkg.go.dev/inet.af/netaddr#IPRange.Prefixes

Many thanks to Brad Fitzpatrick for the awesome code and changelog to
make it possible to understand what is going on.
2021-05-21 17:50:31 +02:00
Gibheer c2bf09fd9e add view to get container hierarchy 2021-05-21 17:50:19 +02:00
Gibheer 8131e0a7e7 add history support
This commit consists of two things.

1. server.go will now set two variables for the current transaction, the
   username and request id. These are transaction local and therefore do
   not leak into the connection.

2. The initial schema received a history table and a trigger. This
   trigger writes changes into the history table. When inserting records
   the function will pull the transaction local variables and add them
   to the record.
   The trigger is added to all tables, so that a complete changelog is
   created.

These changes serve as the basis for further features. One is the
searching for changes on specific resources (think history rr, history
zone, ...).
The other feature is a way to subscribe to changes in the database based
on filters. This will be the way to implement the output feature of dim.
2021-05-09 20:32:34 +02:00
Gibheer a19eaa851f add missing fields to initial schema 2021-05-08 22:39:42 +02:00
Gibheer 5ed6482400 the pool_id should be nullable
Containers are subnets in vairous ranges. But only when a subnet is
assigned a pool, it is truly a subnet. When it is not assigned to a
pool, it is considered a container.

This serves the purpose of grouping or blocking containers for different
purposes, so we need to keep that up.
2021-05-03 22:38:49 +02:00
Gibheer c18d165a5f fix some schema issues 2021-05-03 19:41:06 +02:00
Gibheer 1015861af8 add initial database schema
Usermanagement is still missing, but it is a first sketch on how things
could look like.
2021-04-24 21:42:19 +02:00