Introduce new tables and models for the enablement-only secret push protection profile

Why are we doing this work

In this issue, we will introduce the required database tables and their associated models to enable the rest of the security scan profiles effort.

Implementation plan

Introduce the following tables;

  1. security_scan_profiles

        Column          |           Type           | Nullable | Default
    --------------------+--------------------------+----------+--------
     id                 | bigint                   | not null | nextval(sequence)
     created_at         | timestamp with time zone | not null |
     updated_at         | timestamp with time zone | not null |
     namespace_id       | bigint                   | not null |
     type               | smallint                 | not null |
     gitlab_recommended | boolean                  | not null | false
     name               | text                     | not null |
     description        | text                     |          |
    • Configure LFK for the namespace_id column.
    • Add a 256-character text limit for the name column.
    • Add a 2048-character text limit for the description column.
    • Add a compound unique index on namespace_id, type, and name(case insensitive) columns.
  2. security_scan_profiles_projects

          Column     |           Type           | Nullable |  Default
    -----------------+--------------------------+----------+---------
     id              | bigint                   | not null | nextval(sequence)
     created_at      | timestamp with time zone | not null |
     updated_at      | timestamp with time zone | not null |
     scan_profile_id | bigint                   | not null |
     project_id      | bigint                   | not null |
    • Configure LFK for the project_id column.
    • Add a foreign key to the scan_profile_id with cascading delete configuration.
  3. security_scan_profile_triggers

          Column      |           Type           | Nullable |   Default
    ------------------+--------------------------+----------+------------
     id               | bigint                   | not null | nextval(sequence)
     created_at       | timestamp with time zone | not null |
     updated_at       | timestamp with time zone | not null |
     scan_profile_id  | bigint                   | not null |
     namespace_id     | bigint                   | not null |
     type             | smallint                 | not null |
    • Configure LFK for the namespace_id column.
    • Add a foreign key to the scan_profile_id with cascading delete configuration.

Verification steps

  • Check the schema on the production database.
Edited by Mehmet Emin INAC