Skip to content

Commit

Permalink
Add a table for profiles
Browse files Browse the repository at this point in the history
This commit adds a table for profiles so that we can reference controls,
and results to a parent profile.

This table is not designed, at least initially, to store more than just
a profile name and some metadata. This area will be tricky to navigate
moving forward since it would be idea to rely on OSCAL defintions for
profiles, and use OSCAL profiles distributed by standards bodies, and
not maintain them in a service.

This approach is being discussed in issue #84.
  • Loading branch information
rhmdnd committed Aug 3, 2022
1 parent 059c06d commit 894c6cc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions migrations/000006_create_profiles_table.down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DROP TABLE IF EXISTS profiles;
7 changes: 7 additions & 0 deletions migrations/000006_create_profiles_table.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
CREATE TABLE IF NOT EXISTS profiles (
id uuid PRIMARY KEY,
name VARCHAR(255),
metadata_id UUID,
CONSTRAINT fk_profiles_metadata_id FOREIGN KEY (metadata_id) REFERENCES metadata(id)
);

2 changes: 1 addition & 1 deletion tests/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ func TestMigration(t *testing.T) { // nolint:paralleltest // database tests shou
// Upgrade the database and make sure all upgrades apply cleanly.
err = m.Up()
version, dirty, _ = m.Version()
expectedVersion = uint(5)
expectedVersion = uint(6)
assert.Equal(t, expectedVersion, version, "Database version mismatch: want %d but got %d", expectedVersion, version)
assert.Equal(t, false, dirty, "Database state mismatch: want %t but got %t", false, dirty)
assert.Equal(t, err, nil, "Error upgrading the database: %s", err)
Expand Down

0 comments on commit 894c6cc

Please sign in to comment.