Create Schema Manager and propagate contexts into the DB calls downstream.
Add checks at controller startup and database init for correct schema version and schema migration dirty bit being set.
* Reorganize the db migration .sql scripts into individual schema version directories and generate the sql httpfs fakeFile accordingly.
* Created a /dev schema version directory to hold db schema updates that have not been finalized.
* Add an 'allow-development-migrations' flag to allow `boundary database init` to be executed even when there are schema updates in /dev.
* Define initial warehouse schema
* Add session id as the primary key to the session accumulating fact table
* Insert a row to use instead of nulls in the time and date dimensions
* Add missing attributes and a partial index
* Rename files
* Refactor: move fact table to a separate migration
* Add domain types for the warehouse
* Add session connection transaction fact table
* Change columns to match ingress data types
* Add views for host dimension ingress
* Create source and target views for the host and user dimensions
* Generate random ID for dimension table primary key
* Formatting changes
* Add current dimension id to target views
* Implement upsert function for host dimension
* Use domain types for upsert function parameters
* Fix indentation
* Add wh_public_id domain type
* Fix value of type columns when the other columns are null
* Implement upsert function for user dimension
* Add warehouse domain types for timestamps and text fields
* Move fact table migrations to a higher number
* Add functions for getting the current date and current time IDs
* Rename backend to endpoint in column names
* Rename fact tables
The fact tables are actually accumulating fact tables not transactional
fact tables.
* Add default value to connection_authorized_time column
* Update session fact table
* Add session_max_seconds, session_connection_limit, and default_port to wh_host_dimension
* Move session table above connection table
* Add after insert trigger to session table for warehouse ingress
* Add fk from connection warehouse table to session warehouse table
* Implement insert trigger for session connections
* Update warehouse for a user having multiple auth accounts
* Rename warehouse columns to be consistent with operational tables
* Add connection specific columns to the connection fact table
* Update session calculations in warehouse
* Rename functions and formatting changes
* Rename session columns to match names of session states
* Implement warehouse triggers for session and connection state changes
* Run 'make migrations'
* Use a static start and end date for the warehouse date dimension
* Document warehouse functions
* Remove outdated TODO comments
* Add TODO comments for additional dimensions and fact table columns
This also then removes support for docker-based containing starting (for
now) from platforms other than windows/darwin/linux as there are build
issues on several.
If it's a useful named resource and people accidentally delete it e.g.
with TF, they can't get it back. This doesn't affect TF's ability to
manage it, just delete.
* Update protos and gen
* Add new values to targets CLI command
* Lots more plumbing of new parameters through everything
* allow fields to be set to zero value.
* Disallow set but empty name/description strings in create/update verifiers
Co-authored-by: Jim Lambert <jlambert@hashicorp.com>
* Add database URL.
This allows specification of either a file://, env://, or other string.
If it starts with file:// or env:// the actual value will be read from
those resources.
* Tidy up the KMS output
* Also run migrations in test mode when specifying the URL