sourcegraph/internal/database/schema.codeinsights.json
Keegan Carruthers-Smith cbd12608b5
database: run tenant_id migration outside of a transaction (#64410)
We hit a deadlock when deploying this migration to s2. This is because
within our transaction of the migration we likely didn't obtain table
locks in the same order as a transaction in our application code.

So this commit introduces a new migration metadata field
"noTransaction". The documentation for migrator says you should create a
migration per needed transactions. However, this would require us to
create 100s of migrations. We believe the better approach is introducing
this field and barely advertising it.

When reading the code which actually runs migrations, there is no extra
logic done outside of BEGIN; run_migration; COMMIT; so this change is
safe.

We update the migrations to avoid duplicating the function name we
introduce in case something goes wrong (now that the transaction could
leak out the function name).

Test Plan: The actual migrations are tested by go test. I added a test
assertion that we don't call Transact, but to be honest that is super
sketchy. However, we couldn't actually find any test fixtures which
actually run against the DB. So that would require a much deeper
investment for how simple the code change is.

Co-authored-by: Erik Seliger <erikseliger@me.com>
2024-08-13 07:08:19 +02:00

3649 lines
115 KiB
JSON

{
"Extensions": [
"citext",
"pg_trgm"
],
"Enums": [
{
"Name": "presentation_type_enum",
"Labels": [
"LINE",
"PIE"
]
},
{
"Name": "series_sort_direction_enum",
"Labels": [
"ASC",
"DESC"
]
},
{
"Name": "series_sort_mode_enum",
"Labels": [
"RESULT_COUNT",
"LEXICOGRAPHICAL",
"DATE_ADDED"
]
},
{
"Name": "time_unit",
"Labels": [
"HOUR",
"DAY",
"WEEK",
"MONTH",
"YEAR"
]
}
],
"Functions": null,
"Sequences": [
{
"Name": "dashboard_grants_id_seq",
"TypeName": "integer",
"StartValue": 1,
"MinimumValue": 1,
"MaximumValue": 2147483647,
"Increment": 1,
"CycleOption": "NO"
},
{
"Name": "dashboard_id_seq",
"TypeName": "integer",
"StartValue": 1,
"MinimumValue": 1,
"MaximumValue": 2147483647,
"Increment": 1,
"CycleOption": "NO"
},
{
"Name": "dashboard_insight_view_id_seq",
"TypeName": "integer",
"StartValue": 1,
"MinimumValue": 1,
"MaximumValue": 2147483647,
"Increment": 1,
"CycleOption": "NO"
},
{
"Name": "insight_series_backfill_id_seq",
"TypeName": "integer",
"StartValue": 1,
"MinimumValue": 1,
"MaximumValue": 2147483647,
"Increment": 1,
"CycleOption": "NO"
},
{
"Name": "insight_series_id_seq",
"TypeName": "integer",
"StartValue": 1,
"MinimumValue": 1,
"MaximumValue": 2147483647,
"Increment": 1,
"CycleOption": "NO"
},
{
"Name": "insight_series_incomplete_points_id_seq",
"TypeName": "integer",
"StartValue": 1,
"MinimumValue": 1,
"MaximumValue": 2147483647,
"Increment": 1,
"CycleOption": "NO"
},
{
"Name": "insight_view_grants_id_seq",
"TypeName": "integer",
"StartValue": 1,
"MinimumValue": 1,
"MaximumValue": 2147483647,
"Increment": 1,
"CycleOption": "NO"
},
{
"Name": "insight_view_id_seq",
"TypeName": "integer",
"StartValue": 1,
"MinimumValue": 1,
"MaximumValue": 2147483647,
"Increment": 1,
"CycleOption": "NO"
},
{
"Name": "insights_background_jobs_id_seq",
"TypeName": "integer",
"StartValue": 1,
"MinimumValue": 1,
"MaximumValue": 2147483647,
"Increment": 1,
"CycleOption": "NO"
},
{
"Name": "insights_data_retention_jobs_id_seq",
"TypeName": "integer",
"StartValue": 1,
"MinimumValue": 1,
"MaximumValue": 2147483647,
"Increment": 1,
"CycleOption": "NO"
},
{
"Name": "metadata_id_seq",
"TypeName": "bigint",
"StartValue": 1,
"MinimumValue": 1,
"MaximumValue": 9223372036854775807,
"Increment": 1,
"CycleOption": "NO"
},
{
"Name": "migration_logs_id_seq",
"TypeName": "integer",
"StartValue": 1,
"MinimumValue": 1,
"MaximumValue": 2147483647,
"Increment": 1,
"CycleOption": "NO"
},
{
"Name": "repo_iterator_errors_id_seq",
"TypeName": "integer",
"StartValue": 1,
"MinimumValue": 1,
"MaximumValue": 2147483647,
"Increment": 1,
"CycleOption": "NO"
},
{
"Name": "repo_iterator_id_seq",
"TypeName": "integer",
"StartValue": 1,
"MinimumValue": 1,
"MaximumValue": 2147483647,
"Increment": 1,
"CycleOption": "NO"
},
{
"Name": "repo_names_id_seq",
"TypeName": "bigint",
"StartValue": 1,
"MinimumValue": 1,
"MaximumValue": 9223372036854775807,
"Increment": 1,
"CycleOption": "NO"
}
],
"Tables": [
{
"Name": "archived_insight_series_recording_times",
"Comment": "",
"Columns": [
{
"Name": "insight_series_id",
"Index": 1,
"TypeName": "integer",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "recording_time",
"Index": 2,
"TypeName": "timestamp with time zone",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "snapshot",
"Index": 3,
"TypeName": "boolean",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "tenant_id",
"Index": 4,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
}
],
"Indexes": [
{
"Name": "archived_insight_series_recor_insight_series_id_recording_t_key",
"IsPrimaryKey": false,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX archived_insight_series_recor_insight_series_id_recording_t_key ON archived_insight_series_recording_times USING btree (insight_series_id, recording_time)",
"ConstraintType": "u",
"ConstraintDefinition": "UNIQUE (insight_series_id, recording_time)"
}
],
"Constraints": [
{
"Name": "archived_insight_series_recording_times_tenant_id_fkey",
"ConstraintType": "f",
"RefTableName": "tenants",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON UPDATE CASCADE ON DELETE CASCADE"
},
{
"Name": "insight_series_id_fkey",
"ConstraintType": "f",
"RefTableName": "insight_series",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (insight_series_id) REFERENCES insight_series(id) ON DELETE CASCADE"
}
],
"Triggers": []
},
{
"Name": "archived_series_points",
"Comment": "",
"Columns": [
{
"Name": "capture",
"Index": 7,
"TypeName": "text",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "original_repo_name_id",
"Index": 6,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "repo_id",
"Index": 4,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "repo_name_id",
"Index": 5,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "series_id",
"Index": 1,
"TypeName": "text",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "tenant_id",
"Index": 8,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "time",
"Index": 2,
"TypeName": "timestamp with time zone",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "value",
"Index": 3,
"TypeName": "double precision",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
}
],
"Indexes": [],
"Constraints": [
{
"Name": "archived_series_points_tenant_id_fkey",
"ConstraintType": "f",
"RefTableName": "tenants",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON UPDATE CASCADE ON DELETE CASCADE"
},
{
"Name": "check_repo_fields_specifity",
"ConstraintType": "c",
"RefTableName": "",
"IsDeferrable": false,
"ConstraintDefinition": "CHECK (repo_id IS NULL AND repo_name_id IS NULL AND original_repo_name_id IS NULL OR repo_id IS NOT NULL AND repo_name_id IS NOT NULL AND original_repo_name_id IS NOT NULL)"
},
{
"Name": "insight_series_series_id_fkey",
"ConstraintType": "f",
"RefTableName": "insight_series",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (series_id) REFERENCES insight_series(series_id) ON DELETE CASCADE"
}
],
"Triggers": []
},
{
"Name": "dashboard",
"Comment": "Metadata for dashboards of insights",
"Columns": [
{
"Name": "created_at",
"Index": 3,
"TypeName": "timestamp without time zone",
"IsNullable": false,
"Default": "now()",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "Timestamp the dashboard was initially created."
},
{
"Name": "created_by_user_id",
"Index": 4,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "User that created the dashboard, if available."
},
{
"Name": "deleted_at",
"Index": 6,
"TypeName": "timestamp without time zone",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "Set to the time the dashboard was soft deleted."
},
{
"Name": "id",
"Index": 1,
"TypeName": "integer",
"IsNullable": false,
"Default": "nextval('dashboard_id_seq'::regclass)",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "last_updated_at",
"Index": 5,
"TypeName": "timestamp without time zone",
"IsNullable": false,
"Default": "now()",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "Time the dashboard was last updated, either metadata or insights."
},
{
"Name": "save",
"Index": 7,
"TypeName": "boolean",
"IsNullable": false,
"Default": "false",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "TEMPORARY Do not delete this dashboard when migrating settings."
},
{
"Name": "tenant_id",
"Index": 9,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "title",
"Index": 2,
"TypeName": "text",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "Title of the dashboard"
},
{
"Name": "type",
"Index": 8,
"TypeName": "text",
"IsNullable": false,
"Default": "'standard'::text",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
}
],
"Indexes": [
{
"Name": "dashboard_pk",
"IsPrimaryKey": true,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX dashboard_pk ON dashboard USING btree (id)",
"ConstraintType": "p",
"ConstraintDefinition": "PRIMARY KEY (id)"
}
],
"Constraints": [
{
"Name": "dashboard_tenant_id_fkey",
"ConstraintType": "f",
"RefTableName": "tenants",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON UPDATE CASCADE ON DELETE CASCADE"
}
],
"Triggers": []
},
{
"Name": "dashboard_grants",
"Comment": "Permission grants for dashboards. Each row should represent a unique principal (user, org, etc).",
"Columns": [
{
"Name": "dashboard_id",
"Index": 2,
"TypeName": "integer",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "global",
"Index": 5,
"TypeName": "boolean",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "Grant that does not belong to any specific principal and is granted to all users."
},
{
"Name": "id",
"Index": 1,
"TypeName": "integer",
"IsNullable": false,
"Default": "nextval('dashboard_grants_id_seq'::regclass)",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "org_id",
"Index": 4,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "Org ID that that receives this grant."
},
{
"Name": "tenant_id",
"Index": 6,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "user_id",
"Index": 3,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "User ID that that receives this grant."
}
],
"Indexes": [
{
"Name": "dashboard_grants_pk",
"IsPrimaryKey": true,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX dashboard_grants_pk ON dashboard_grants USING btree (id)",
"ConstraintType": "p",
"ConstraintDefinition": "PRIMARY KEY (id)"
},
{
"Name": "dashboard_grants_dashboard_id_index",
"IsPrimaryKey": false,
"IsUnique": false,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE INDEX dashboard_grants_dashboard_id_index ON dashboard_grants USING btree (dashboard_id)",
"ConstraintType": "",
"ConstraintDefinition": ""
},
{
"Name": "dashboard_grants_global_idx",
"IsPrimaryKey": false,
"IsUnique": false,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE INDEX dashboard_grants_global_idx ON dashboard_grants USING btree (global) WHERE global IS TRUE",
"ConstraintType": "",
"ConstraintDefinition": ""
},
{
"Name": "dashboard_grants_org_id_idx",
"IsPrimaryKey": false,
"IsUnique": false,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE INDEX dashboard_grants_org_id_idx ON dashboard_grants USING btree (org_id)",
"ConstraintType": "",
"ConstraintDefinition": ""
},
{
"Name": "dashboard_grants_user_id_idx",
"IsPrimaryKey": false,
"IsUnique": false,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE INDEX dashboard_grants_user_id_idx ON dashboard_grants USING btree (user_id)",
"ConstraintType": "",
"ConstraintDefinition": ""
}
],
"Constraints": [
{
"Name": "dashboard_grants_dashboard_id_fk",
"ConstraintType": "f",
"RefTableName": "dashboard",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (dashboard_id) REFERENCES dashboard(id) ON DELETE CASCADE"
},
{
"Name": "dashboard_grants_tenant_id_fkey",
"ConstraintType": "f",
"RefTableName": "tenants",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON UPDATE CASCADE ON DELETE CASCADE"
}
],
"Triggers": []
},
{
"Name": "dashboard_insight_view",
"Comment": "",
"Columns": [
{
"Name": "dashboard_id",
"Index": 2,
"TypeName": "integer",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "id",
"Index": 1,
"TypeName": "integer",
"IsNullable": false,
"Default": "nextval('dashboard_insight_view_id_seq'::regclass)",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "insight_view_id",
"Index": 3,
"TypeName": "integer",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "tenant_id",
"Index": 4,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
}
],
"Indexes": [
{
"Name": "dashboard_insight_view_pk",
"IsPrimaryKey": true,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX dashboard_insight_view_pk ON dashboard_insight_view USING btree (id)",
"ConstraintType": "p",
"ConstraintDefinition": "PRIMARY KEY (id)"
},
{
"Name": "unique_dashboard_id_insight_view_id",
"IsPrimaryKey": false,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX unique_dashboard_id_insight_view_id ON dashboard_insight_view USING btree (dashboard_id, insight_view_id)",
"ConstraintType": "u",
"ConstraintDefinition": "UNIQUE (dashboard_id, insight_view_id)"
},
{
"Name": "dashboard_insight_view_dashboard_id_fk_idx",
"IsPrimaryKey": false,
"IsUnique": false,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE INDEX dashboard_insight_view_dashboard_id_fk_idx ON dashboard_insight_view USING btree (dashboard_id)",
"ConstraintType": "",
"ConstraintDefinition": ""
},
{
"Name": "dashboard_insight_view_insight_view_id_fk_idx",
"IsPrimaryKey": false,
"IsUnique": false,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE INDEX dashboard_insight_view_insight_view_id_fk_idx ON dashboard_insight_view USING btree (insight_view_id)",
"ConstraintType": "",
"ConstraintDefinition": ""
}
],
"Constraints": [
{
"Name": "dashboard_insight_view_dashboard_id_fk",
"ConstraintType": "f",
"RefTableName": "dashboard",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (dashboard_id) REFERENCES dashboard(id) ON DELETE CASCADE"
},
{
"Name": "dashboard_insight_view_insight_view_id_fk",
"ConstraintType": "f",
"RefTableName": "insight_view",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (insight_view_id) REFERENCES insight_view(id) ON DELETE CASCADE"
},
{
"Name": "dashboard_insight_view_tenant_id_fkey",
"ConstraintType": "f",
"RefTableName": "tenants",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON UPDATE CASCADE ON DELETE CASCADE"
}
],
"Triggers": []
},
{
"Name": "insight_series",
"Comment": "Data series that comprise code insights.",
"Columns": [
{
"Name": "backfill_attempts",
"Index": 19,
"TypeName": "integer",
"IsNullable": false,
"Default": "0",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "backfill_completed_at",
"Index": 21,
"TypeName": "timestamp without time zone",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "backfill_queued_at",
"Index": 9,
"TypeName": "timestamp without time zone",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "created_at",
"Index": 4,
"TypeName": "timestamp without time zone",
"IsNullable": false,
"Default": "CURRENT_TIMESTAMP",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "Timestamp when this series was created"
},
{
"Name": "deleted_at",
"Index": 8,
"TypeName": "timestamp without time zone",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "Timestamp of a soft-delete of this row."
},
{
"Name": "generated_from_capture_groups",
"Index": 15,
"TypeName": "boolean",
"IsNullable": false,
"Default": "false",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "generation_method",
"Index": 16,
"TypeName": "text",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "Specifies the execution method for how this series is generated. This helps the system understand how to generate the time series data."
},
{
"Name": "group_by",
"Index": 18,
"TypeName": "text",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "id",
"Index": 1,
"TypeName": "integer",
"IsNullable": false,
"Default": "nextval('insight_series_id_seq'::regclass)",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "Primary key ID of this series"
},
{
"Name": "just_in_time",
"Index": 17,
"TypeName": "boolean",
"IsNullable": false,
"Default": "false",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "Specifies if the series should be resolved just in time at query time, or recorded in background processing."
},
{
"Name": "last_recorded_at",
"Index": 6,
"TypeName": "timestamp without time zone",
"IsNullable": false,
"Default": "(CURRENT_TIMESTAMP - '10 years'::interval)",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "Timestamp when this series was last recorded (non-historical)."
},
{
"Name": "last_snapshot_at",
"Index": 10,
"TypeName": "timestamp without time zone",
"IsNullable": true,
"Default": "(CURRENT_TIMESTAMP - '10 years'::interval)",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "needs_migration",
"Index": 20,
"TypeName": "boolean",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "next_recording_after",
"Index": 7,
"TypeName": "timestamp without time zone",
"IsNullable": false,
"Default": "CURRENT_TIMESTAMP",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "Timestamp when this series should next record (non-historical)."
},
{
"Name": "next_snapshot_after",
"Index": 11,
"TypeName": "timestamp without time zone",
"IsNullable": true,
"Default": "CURRENT_TIMESTAMP",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "oldest_historical_at",
"Index": 5,
"TypeName": "timestamp without time zone",
"IsNullable": false,
"Default": "(CURRENT_TIMESTAMP - '1 year'::interval)",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "Timestamp representing the oldest point of which this series is backfilled."
},
{
"Name": "query",
"Index": 3,
"TypeName": "text",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "Query string that generates this series"
},
{
"Name": "query_old",
"Index": 24,
"TypeName": "text",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "Backup for migration. Remove with release 5.6 or later."
},
{
"Name": "repositories",
"Index": 12,
"TypeName": "text[]",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "repository_criteria",
"Index": 23,
"TypeName": "text",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "The search criteria used to determine the repositories that are included in this series."
},
{
"Name": "sample_interval_unit",
"Index": 13,
"TypeName": "time_unit",
"IsNullable": false,
"Default": "'MONTH'::time_unit",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "sample_interval_value",
"Index": 14,
"TypeName": "integer",
"IsNullable": false,
"Default": "1",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "series_id",
"Index": 2,
"TypeName": "text",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "Timestamp that this series completed a full repository iteration for backfill. This flag has limited semantic value, and only means it tried to queue up queries for each repository. It does not guarantee success on those queries."
},
{
"Name": "supports_augmentation",
"Index": 22,
"TypeName": "boolean",
"IsNullable": false,
"Default": "true",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "tenant_id",
"Index": 25,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
}
],
"Indexes": [
{
"Name": "insight_series_pkey",
"IsPrimaryKey": true,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX insight_series_pkey ON insight_series USING btree (id)",
"ConstraintType": "p",
"ConstraintDefinition": "PRIMARY KEY (id)"
},
{
"Name": "insight_series_series_id_unique_idx",
"IsPrimaryKey": false,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX insight_series_series_id_unique_idx ON insight_series USING btree (series_id)",
"ConstraintType": "",
"ConstraintDefinition": ""
},
{
"Name": "insight_series_deleted_at_idx",
"IsPrimaryKey": false,
"IsUnique": false,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE INDEX insight_series_deleted_at_idx ON insight_series USING btree (deleted_at)",
"ConstraintType": "",
"ConstraintDefinition": ""
},
{
"Name": "insight_series_next_recording_after_idx",
"IsPrimaryKey": false,
"IsUnique": false,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE INDEX insight_series_next_recording_after_idx ON insight_series USING btree (next_recording_after)",
"ConstraintType": "",
"ConstraintDefinition": ""
}
],
"Constraints": [
{
"Name": "insight_series_tenant_id_fkey",
"ConstraintType": "f",
"RefTableName": "tenants",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON UPDATE CASCADE ON DELETE CASCADE"
}
],
"Triggers": []
},
{
"Name": "insight_series_backfill",
"Comment": "",
"Columns": [
{
"Name": "estimated_cost",
"Index": 4,
"TypeName": "double precision",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "id",
"Index": 1,
"TypeName": "integer",
"IsNullable": false,
"Default": "nextval('insight_series_backfill_id_seq'::regclass)",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "repo_iterator_id",
"Index": 3,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "series_id",
"Index": 2,
"TypeName": "integer",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "state",
"Index": 5,
"TypeName": "text",
"IsNullable": false,
"Default": "'new'::text",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "tenant_id",
"Index": 6,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
}
],
"Indexes": [
{
"Name": "insight_series_backfill_pk",
"IsPrimaryKey": true,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX insight_series_backfill_pk ON insight_series_backfill USING btree (id)",
"ConstraintType": "p",
"ConstraintDefinition": "PRIMARY KEY (id)"
}
],
"Constraints": [
{
"Name": "insight_series_backfill_series_id_fk",
"ConstraintType": "f",
"RefTableName": "insight_series",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (series_id) REFERENCES insight_series(id) ON DELETE CASCADE"
},
{
"Name": "insight_series_backfill_tenant_id_fkey",
"ConstraintType": "f",
"RefTableName": "tenants",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON UPDATE CASCADE ON DELETE CASCADE"
}
],
"Triggers": []
},
{
"Name": "insight_series_incomplete_points",
"Comment": "",
"Columns": [
{
"Name": "id",
"Index": 1,
"TypeName": "integer",
"IsNullable": false,
"Default": "nextval('insight_series_incomplete_points_id_seq'::regclass)",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "reason",
"Index": 3,
"TypeName": "text",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "repo_id",
"Index": 5,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "series_id",
"Index": 2,
"TypeName": "integer",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "tenant_id",
"Index": 6,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "time",
"Index": 4,
"TypeName": "timestamp without time zone",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
}
],
"Indexes": [
{
"Name": "insight_series_incomplete_points_pk",
"IsPrimaryKey": true,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX insight_series_incomplete_points_pk ON insight_series_incomplete_points USING btree (id)",
"ConstraintType": "p",
"ConstraintDefinition": "PRIMARY KEY (id)"
},
{
"Name": "insight_series_incomplete_points_unique_idx",
"IsPrimaryKey": false,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX insight_series_incomplete_points_unique_idx ON insight_series_incomplete_points USING btree (series_id, reason, \"time\", repo_id)",
"ConstraintType": "",
"ConstraintDefinition": ""
}
],
"Constraints": [
{
"Name": "insight_series_incomplete_points_series_id_fk",
"ConstraintType": "f",
"RefTableName": "insight_series",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (series_id) REFERENCES insight_series(id) ON DELETE CASCADE"
},
{
"Name": "insight_series_incomplete_points_tenant_id_fkey",
"ConstraintType": "f",
"RefTableName": "tenants",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON UPDATE CASCADE ON DELETE CASCADE"
}
],
"Triggers": []
},
{
"Name": "insight_series_recording_times",
"Comment": "",
"Columns": [
{
"Name": "insight_series_id",
"Index": 1,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "recording_time",
"Index": 2,
"TypeName": "timestamp with time zone",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "snapshot",
"Index": 3,
"TypeName": "boolean",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "tenant_id",
"Index": 4,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
}
],
"Indexes": [
{
"Name": "insight_series_recording_time_insight_series_id_recording_t_key",
"IsPrimaryKey": false,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX insight_series_recording_time_insight_series_id_recording_t_key ON insight_series_recording_times USING btree (insight_series_id, recording_time)",
"ConstraintType": "u",
"ConstraintDefinition": "UNIQUE (insight_series_id, recording_time)"
}
],
"Constraints": [
{
"Name": "insight_series_id_fkey",
"ConstraintType": "f",
"RefTableName": "insight_series",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (insight_series_id) REFERENCES insight_series(id) ON DELETE CASCADE"
},
{
"Name": "insight_series_recording_times_tenant_id_fkey",
"ConstraintType": "f",
"RefTableName": "tenants",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON UPDATE CASCADE ON DELETE CASCADE"
}
],
"Triggers": []
},
{
"Name": "insight_view",
"Comment": "Views for insight data series. An insight view is an abstraction on top of an insight data series that allows for lightweight modifications to filters or metadata without regenerating the underlying series.",
"Columns": [
{
"Name": "default_filter_exclude_repo_regex",
"Index": 6,
"TypeName": "text",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "default_filter_include_repo_regex",
"Index": 5,
"TypeName": "text",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "default_filter_search_contexts",
"Index": 10,
"TypeName": "text[]",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "description",
"Index": 3,
"TypeName": "text",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "Description of the view. This may render in a chart depending on the view type."
},
{
"Name": "id",
"Index": 1,
"TypeName": "integer",
"IsNullable": false,
"Default": "nextval('insight_view_id_seq'::regclass)",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "Primary key ID for this view"
},
{
"Name": "is_frozen",
"Index": 9,
"TypeName": "boolean",
"IsNullable": false,
"Default": "false",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "other_threshold",
"Index": 7,
"TypeName": "double precision",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "Percent threshold for grouping series under \"other\""
},
{
"Name": "presentation_type",
"Index": 8,
"TypeName": "presentation_type_enum",
"IsNullable": false,
"Default": "'LINE'::presentation_type_enum",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "The basic presentation type for the insight view. (e.g Line, Pie, etc.)"
},
{
"Name": "series_limit",
"Index": 13,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "series_num_samples",
"Index": 14,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "series_sort_direction",
"Index": 12,
"TypeName": "series_sort_direction_enum",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "series_sort_mode",
"Index": 11,
"TypeName": "series_sort_mode_enum",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "tenant_id",
"Index": 15,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "title",
"Index": 2,
"TypeName": "text",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "Title of the view. This may render in a chart depending on the view type."
},
{
"Name": "unique_id",
"Index": 4,
"TypeName": "text",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "Globally unique identifier for this view that is externally referencable."
}
],
"Indexes": [
{
"Name": "insight_view_pkey",
"IsPrimaryKey": true,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX insight_view_pkey ON insight_view USING btree (id)",
"ConstraintType": "p",
"ConstraintDefinition": "PRIMARY KEY (id)"
},
{
"Name": "insight_view_unique_id_unique_idx",
"IsPrimaryKey": false,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX insight_view_unique_id_unique_idx ON insight_view USING btree (unique_id)",
"ConstraintType": "",
"ConstraintDefinition": ""
}
],
"Constraints": [
{
"Name": "insight_view_tenant_id_fkey",
"ConstraintType": "f",
"RefTableName": "tenants",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON UPDATE CASCADE ON DELETE CASCADE"
}
],
"Triggers": []
},
{
"Name": "insight_view_grants",
"Comment": "Permission grants for insight views. Each row should represent a unique principal (user, org, etc).",
"Columns": [
{
"Name": "global",
"Index": 5,
"TypeName": "boolean",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "Grant that does not belong to any specific principal and is granted to all users."
},
{
"Name": "id",
"Index": 1,
"TypeName": "integer",
"IsNullable": false,
"Default": "nextval('insight_view_grants_id_seq'::regclass)",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "insight_view_id",
"Index": 2,
"TypeName": "integer",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "org_id",
"Index": 4,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "Org ID that that receives this grant."
},
{
"Name": "tenant_id",
"Index": 6,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "user_id",
"Index": 3,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "User ID that that receives this grant."
}
],
"Indexes": [
{
"Name": "insight_view_grants_pk",
"IsPrimaryKey": true,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX insight_view_grants_pk ON insight_view_grants USING btree (id)",
"ConstraintType": "p",
"ConstraintDefinition": "PRIMARY KEY (id)"
},
{
"Name": "insight_view_grants_global_idx",
"IsPrimaryKey": false,
"IsUnique": false,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE INDEX insight_view_grants_global_idx ON insight_view_grants USING btree (global) WHERE global IS TRUE",
"ConstraintType": "",
"ConstraintDefinition": ""
},
{
"Name": "insight_view_grants_insight_view_id_index",
"IsPrimaryKey": false,
"IsUnique": false,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE INDEX insight_view_grants_insight_view_id_index ON insight_view_grants USING btree (insight_view_id)",
"ConstraintType": "",
"ConstraintDefinition": ""
},
{
"Name": "insight_view_grants_org_id_idx",
"IsPrimaryKey": false,
"IsUnique": false,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE INDEX insight_view_grants_org_id_idx ON insight_view_grants USING btree (org_id)",
"ConstraintType": "",
"ConstraintDefinition": ""
},
{
"Name": "insight_view_grants_user_id_idx",
"IsPrimaryKey": false,
"IsUnique": false,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE INDEX insight_view_grants_user_id_idx ON insight_view_grants USING btree (user_id)",
"ConstraintType": "",
"ConstraintDefinition": ""
}
],
"Constraints": [
{
"Name": "insight_view_grants_insight_view_id_fk",
"ConstraintType": "f",
"RefTableName": "insight_view",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (insight_view_id) REFERENCES insight_view(id) ON DELETE CASCADE"
},
{
"Name": "insight_view_grants_tenant_id_fkey",
"ConstraintType": "f",
"RefTableName": "tenants",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON UPDATE CASCADE ON DELETE CASCADE"
}
],
"Triggers": []
},
{
"Name": "insight_view_series",
"Comment": "Join table to correlate data series with insight views",
"Columns": [
{
"Name": "insight_series_id",
"Index": 2,
"TypeName": "integer",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "Foreign key to insight data series."
},
{
"Name": "insight_view_id",
"Index": 1,
"TypeName": "integer",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "Foreign key to insight view."
},
{
"Name": "label",
"Index": 3,
"TypeName": "text",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "Label text for this data series. This may render in a chart depending on the view type."
},
{
"Name": "stroke",
"Index": 4,
"TypeName": "text",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "Stroke color metadata for this data series. This may render in a chart depending on the view type."
},
{
"Name": "tenant_id",
"Index": 5,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
}
],
"Indexes": [
{
"Name": "insight_view_series_pkey",
"IsPrimaryKey": true,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX insight_view_series_pkey ON insight_view_series USING btree (insight_view_id, insight_series_id)",
"ConstraintType": "p",
"ConstraintDefinition": "PRIMARY KEY (insight_view_id, insight_series_id)"
}
],
"Constraints": [
{
"Name": "insight_view_series_insight_series_id_fkey",
"ConstraintType": "f",
"RefTableName": "insight_series",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (insight_series_id) REFERENCES insight_series(id)"
},
{
"Name": "insight_view_series_insight_view_id_fkey",
"ConstraintType": "f",
"RefTableName": "insight_view",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (insight_view_id) REFERENCES insight_view(id) ON DELETE CASCADE"
},
{
"Name": "insight_view_series_tenant_id_fkey",
"ConstraintType": "f",
"RefTableName": "tenants",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON UPDATE CASCADE ON DELETE CASCADE"
}
],
"Triggers": []
},
{
"Name": "insights_background_jobs",
"Comment": "",
"Columns": [
{
"Name": "backfill_id",
"Index": 14,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "cancel",
"Index": 13,
"TypeName": "boolean",
"IsNullable": false,
"Default": "false",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "execution_logs",
"Index": 11,
"TypeName": "json[]",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "failure_message",
"Index": 3,
"TypeName": "text",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "finished_at",
"Index": 6,
"TypeName": "timestamp with time zone",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "id",
"Index": 1,
"TypeName": "integer",
"IsNullable": false,
"Default": "nextval('insights_background_jobs_id_seq'::regclass)",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "last_heartbeat_at",
"Index": 10,
"TypeName": "timestamp with time zone",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "num_failures",
"Index": 9,
"TypeName": "integer",
"IsNullable": false,
"Default": "0",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "num_resets",
"Index": 8,
"TypeName": "integer",
"IsNullable": false,
"Default": "0",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "process_after",
"Index": 7,
"TypeName": "timestamp with time zone",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "queued_at",
"Index": 4,
"TypeName": "timestamp with time zone",
"IsNullable": true,
"Default": "now()",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "started_at",
"Index": 5,
"TypeName": "timestamp with time zone",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "state",
"Index": 2,
"TypeName": "text",
"IsNullable": true,
"Default": "'queued'::text",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "tenant_id",
"Index": 15,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "worker_hostname",
"Index": 12,
"TypeName": "text",
"IsNullable": false,
"Default": "''::text",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
}
],
"Indexes": [
{
"Name": "insights_background_jobs_pkey",
"IsPrimaryKey": true,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX insights_background_jobs_pkey ON insights_background_jobs USING btree (id)",
"ConstraintType": "p",
"ConstraintDefinition": "PRIMARY KEY (id)"
},
{
"Name": "insights_jobs_state_idx",
"IsPrimaryKey": false,
"IsUnique": false,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE INDEX insights_jobs_state_idx ON insights_background_jobs USING btree (state)",
"ConstraintType": "",
"ConstraintDefinition": ""
}
],
"Constraints": [
{
"Name": "insights_background_jobs_backfill_id_fkey",
"ConstraintType": "f",
"RefTableName": "insight_series_backfill",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (backfill_id) REFERENCES insight_series_backfill(id) ON DELETE CASCADE"
},
{
"Name": "insights_background_jobs_tenant_id_fkey",
"ConstraintType": "f",
"RefTableName": "tenants",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON UPDATE CASCADE ON DELETE CASCADE"
}
],
"Triggers": []
},
{
"Name": "insights_data_retention_jobs",
"Comment": "",
"Columns": [
{
"Name": "cancel",
"Index": 13,
"TypeName": "boolean",
"IsNullable": false,
"Default": "false",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "execution_logs",
"Index": 11,
"TypeName": "json[]",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "failure_message",
"Index": 3,
"TypeName": "text",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "finished_at",
"Index": 6,
"TypeName": "timestamp with time zone",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "id",
"Index": 1,
"TypeName": "integer",
"IsNullable": false,
"Default": "nextval('insights_data_retention_jobs_id_seq'::regclass)",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "last_heartbeat_at",
"Index": 10,
"TypeName": "timestamp with time zone",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "num_failures",
"Index": 9,
"TypeName": "integer",
"IsNullable": false,
"Default": "0",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "num_resets",
"Index": 8,
"TypeName": "integer",
"IsNullable": false,
"Default": "0",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "process_after",
"Index": 7,
"TypeName": "timestamp with time zone",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "queued_at",
"Index": 4,
"TypeName": "timestamp with time zone",
"IsNullable": true,
"Default": "now()",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "series_id",
"Index": 14,
"TypeName": "integer",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "series_id_string",
"Index": 15,
"TypeName": "text",
"IsNullable": false,
"Default": "''::text",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "started_at",
"Index": 5,
"TypeName": "timestamp with time zone",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "state",
"Index": 2,
"TypeName": "text",
"IsNullable": true,
"Default": "'queued'::text",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "tenant_id",
"Index": 16,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "worker_hostname",
"Index": 12,
"TypeName": "text",
"IsNullable": false,
"Default": "''::text",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
}
],
"Indexes": [
{
"Name": "insights_data_retention_jobs_pkey",
"IsPrimaryKey": true,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX insights_data_retention_jobs_pkey ON insights_data_retention_jobs USING btree (id)",
"ConstraintType": "p",
"ConstraintDefinition": "PRIMARY KEY (id)"
}
],
"Constraints": [
{
"Name": "insights_data_retention_jobs_tenant_id_fkey",
"ConstraintType": "f",
"RefTableName": "tenants",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON UPDATE CASCADE ON DELETE CASCADE"
}
],
"Triggers": []
},
{
"Name": "metadata",
"Comment": "Records arbitrary metadata about events. Stored in a separate table as it is often repeated for multiple events.",
"Columns": [
{
"Name": "id",
"Index": 1,
"TypeName": "bigint",
"IsNullable": false,
"Default": "nextval('metadata_id_seq'::regclass)",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "The metadata ID."
},
{
"Name": "metadata",
"Index": 2,
"TypeName": "jsonb",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "Metadata about some event, this can be any arbitrary JSON emtadata which will be returned when querying events, and can be filtered on and grouped using jsonb operators ?, ?\u0026, ?|, and @\u003e. This should be small data only."
},
{
"Name": "tenant_id",
"Index": 3,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
}
],
"Indexes": [
{
"Name": "metadata_metadata_unique_idx",
"IsPrimaryKey": false,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX metadata_metadata_unique_idx ON metadata USING btree (metadata)",
"ConstraintType": "",
"ConstraintDefinition": ""
},
{
"Name": "metadata_pkey",
"IsPrimaryKey": true,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX metadata_pkey ON metadata USING btree (id)",
"ConstraintType": "p",
"ConstraintDefinition": "PRIMARY KEY (id)"
},
{
"Name": "metadata_metadata_gin",
"IsPrimaryKey": false,
"IsUnique": false,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE INDEX metadata_metadata_gin ON metadata USING gin (metadata)",
"ConstraintType": "",
"ConstraintDefinition": ""
}
],
"Constraints": [
{
"Name": "metadata_tenant_id_fkey",
"ConstraintType": "f",
"RefTableName": "tenants",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON UPDATE CASCADE ON DELETE CASCADE"
}
],
"Triggers": []
},
{
"Name": "migration_logs",
"Comment": "",
"Columns": [
{
"Name": "backfilled",
"Index": 10,
"TypeName": "boolean",
"IsNullable": false,
"Default": "false",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "error_message",
"Index": 9,
"TypeName": "text",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "finished_at",
"Index": 7,
"TypeName": "timestamp with time zone",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "id",
"Index": 1,
"TypeName": "integer",
"IsNullable": false,
"Default": "nextval('migration_logs_id_seq'::regclass)",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "migration_logs_schema_version",
"Index": 2,
"TypeName": "integer",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "schema",
"Index": 3,
"TypeName": "text",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "started_at",
"Index": 6,
"TypeName": "timestamp with time zone",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "success",
"Index": 8,
"TypeName": "boolean",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "up",
"Index": 5,
"TypeName": "boolean",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "version",
"Index": 4,
"TypeName": "integer",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
}
],
"Indexes": [
{
"Name": "migration_logs_pkey",
"IsPrimaryKey": true,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX migration_logs_pkey ON migration_logs USING btree (id)",
"ConstraintType": "p",
"ConstraintDefinition": "PRIMARY KEY (id)"
}
],
"Constraints": null,
"Triggers": []
},
{
"Name": "repo_iterator",
"Comment": "",
"Columns": [
{
"Name": "completed_at",
"Index": 4,
"TypeName": "timestamp without time zone",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "created_at",
"Index": 2,
"TypeName": "timestamp without time zone",
"IsNullable": true,
"Default": "now()",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "id",
"Index": 1,
"TypeName": "integer",
"IsNullable": false,
"Default": "nextval('repo_iterator_id_seq'::regclass)",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "last_updated_at",
"Index": 5,
"TypeName": "timestamp without time zone",
"IsNullable": false,
"Default": "now()",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "percent_complete",
"Index": 7,
"TypeName": "double precision",
"IsNullable": false,
"Default": "0",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "repo_cursor",
"Index": 11,
"TypeName": "integer",
"IsNullable": true,
"Default": "0",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "repos",
"Index": 10,
"TypeName": "integer[]",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "runtime_duration",
"Index": 6,
"TypeName": "bigint",
"IsNullable": false,
"Default": "0",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "started_at",
"Index": 3,
"TypeName": "timestamp without time zone",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "success_count",
"Index": 9,
"TypeName": "integer",
"IsNullable": false,
"Default": "0",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "tenant_id",
"Index": 12,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "total_count",
"Index": 8,
"TypeName": "integer",
"IsNullable": false,
"Default": "0",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
}
],
"Indexes": [
{
"Name": "repo_iterator_pk",
"IsPrimaryKey": true,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX repo_iterator_pk ON repo_iterator USING btree (id)",
"ConstraintType": "p",
"ConstraintDefinition": "PRIMARY KEY (id)"
}
],
"Constraints": [
{
"Name": "repo_iterator_tenant_id_fkey",
"ConstraintType": "f",
"RefTableName": "tenants",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON UPDATE CASCADE ON DELETE CASCADE"
}
],
"Triggers": []
},
{
"Name": "repo_iterator_errors",
"Comment": "",
"Columns": [
{
"Name": "error_message",
"Index": 4,
"TypeName": "text[]",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "failure_count",
"Index": 5,
"TypeName": "integer",
"IsNullable": true,
"Default": "1",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "id",
"Index": 1,
"TypeName": "integer",
"IsNullable": false,
"Default": "nextval('repo_iterator_errors_id_seq'::regclass)",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "repo_id",
"Index": 3,
"TypeName": "integer",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "repo_iterator_id",
"Index": 2,
"TypeName": "integer",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "tenant_id",
"Index": 6,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
}
],
"Indexes": [
{
"Name": "repo_iterator_errors_pk",
"IsPrimaryKey": true,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX repo_iterator_errors_pk ON repo_iterator_errors USING btree (id)",
"ConstraintType": "p",
"ConstraintDefinition": "PRIMARY KEY (id)"
},
{
"Name": "repo_iterator_errors_fk_idx",
"IsPrimaryKey": false,
"IsUnique": false,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE INDEX repo_iterator_errors_fk_idx ON repo_iterator_errors USING btree (repo_iterator_id)",
"ConstraintType": "",
"ConstraintDefinition": ""
}
],
"Constraints": [
{
"Name": "repo_iterator_errors_tenant_id_fkey",
"ConstraintType": "f",
"RefTableName": "tenants",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON UPDATE CASCADE ON DELETE CASCADE"
},
{
"Name": "repo_iterator_fk",
"ConstraintType": "f",
"RefTableName": "repo_iterator",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (repo_iterator_id) REFERENCES repo_iterator(id)"
}
],
"Triggers": []
},
{
"Name": "repo_names",
"Comment": "Records repository names, both historical and present, using a unique repository _name_ ID (unrelated to the repository ID.)",
"Columns": [
{
"Name": "id",
"Index": 1,
"TypeName": "bigint",
"IsNullable": false,
"Default": "nextval('repo_names_id_seq'::regclass)",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "The repository _name_ ID."
},
{
"Name": "name",
"Index": 2,
"TypeName": "citext",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "The repository name string, with unique constraint for table entry deduplication and trigram index for e.g. regex filtering."
},
{
"Name": "tenant_id",
"Index": 3,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
}
],
"Indexes": [
{
"Name": "repo_names_name_unique_idx",
"IsPrimaryKey": false,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX repo_names_name_unique_idx ON repo_names USING btree (name)",
"ConstraintType": "",
"ConstraintDefinition": ""
},
{
"Name": "repo_names_pkey",
"IsPrimaryKey": true,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX repo_names_pkey ON repo_names USING btree (id)",
"ConstraintType": "p",
"ConstraintDefinition": "PRIMARY KEY (id)"
},
{
"Name": "repo_names_name_trgm",
"IsPrimaryKey": false,
"IsUnique": false,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE INDEX repo_names_name_trgm ON repo_names USING gin (lower(name::text) gin_trgm_ops)",
"ConstraintType": "",
"ConstraintDefinition": ""
}
],
"Constraints": [
{
"Name": "check_name_nonempty",
"ConstraintType": "c",
"RefTableName": "",
"IsDeferrable": false,
"ConstraintDefinition": "CHECK (name \u003c\u003e ''::citext)"
},
{
"Name": "repo_names_tenant_id_fkey",
"ConstraintType": "f",
"RefTableName": "tenants",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON UPDATE CASCADE ON DELETE CASCADE"
}
],
"Triggers": []
},
{
"Name": "series_points",
"Comment": "Records events over time associated with a repository (or none, i.e. globally) where a single numerical value is going arbitrarily up and down. Repository association is based on both repository ID and name. The ID can be used to refer toa specific repository, or lookup the current name of a repository after it has been e.g. renamed. The name can be used to refer to the name of the repository at the time of the events creation, for example to trace the change in a gauge back to a repository being renamed.",
"Columns": [
{
"Name": "capture",
"Index": 8,
"TypeName": "text",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "metadata_id",
"Index": 4,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "Associated metadata for this event, if any."
},
{
"Name": "original_repo_name_id",
"Index": 7,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "The repository name as it was known at the time the event was created. It may have been renamed since."
},
{
"Name": "repo_id",
"Index": 5,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "The repository ID (from the main application DB) at the time the event was created. Note that the repository may no longer exist / be valid at query time, however."
},
{
"Name": "repo_name_id",
"Index": 6,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "The most recently known name for the repository, updated periodically to account for e.g. repository renames. If the repository was deleted, this is still the most recently known name. null if the event was not for a single repository (i.e. a global gauge)."
},
{
"Name": "series_id",
"Index": 1,
"TypeName": "text",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "A unique identifier for the series of data being recorded. This is not an ID from another table, but rather just a unique identifier."
},
{
"Name": "tenant_id",
"Index": 9,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "time",
"Index": 2,
"TypeName": "timestamp with time zone",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "The timestamp of the recorded event."
},
{
"Name": "value",
"Index": 3,
"TypeName": "double precision",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "The floating point value at the time of the event."
}
],
"Indexes": [
{
"Name": "series_points_original_repo_name_id_btree",
"IsPrimaryKey": false,
"IsUnique": false,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE INDEX series_points_original_repo_name_id_btree ON series_points USING btree (original_repo_name_id)",
"ConstraintType": "",
"ConstraintDefinition": ""
},
{
"Name": "series_points_repo_id_btree",
"IsPrimaryKey": false,
"IsUnique": false,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE INDEX series_points_repo_id_btree ON series_points USING btree (repo_id)",
"ConstraintType": "",
"ConstraintDefinition": ""
},
{
"Name": "series_points_repo_name_id_btree",
"IsPrimaryKey": false,
"IsUnique": false,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE INDEX series_points_repo_name_id_btree ON series_points USING btree (repo_name_id)",
"ConstraintType": "",
"ConstraintDefinition": ""
},
{
"Name": "series_points_series_id_btree",
"IsPrimaryKey": false,
"IsUnique": false,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE INDEX series_points_series_id_btree ON series_points USING btree (series_id)",
"ConstraintType": "",
"ConstraintDefinition": ""
},
{
"Name": "series_points_series_id_repo_id_time_idx",
"IsPrimaryKey": false,
"IsUnique": false,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE INDEX series_points_series_id_repo_id_time_idx ON series_points USING btree (series_id, repo_id, \"time\")",
"ConstraintType": "",
"ConstraintDefinition": ""
}
],
"Constraints": [
{
"Name": "check_repo_fields_specifity",
"ConstraintType": "c",
"RefTableName": "",
"IsDeferrable": false,
"ConstraintDefinition": "CHECK (repo_id IS NULL AND repo_name_id IS NULL AND original_repo_name_id IS NULL OR repo_id IS NOT NULL AND repo_name_id IS NOT NULL AND original_repo_name_id IS NOT NULL)"
},
{
"Name": "series_points_metadata_id_fkey",
"ConstraintType": "f",
"RefTableName": "metadata",
"IsDeferrable": true,
"ConstraintDefinition": "FOREIGN KEY (metadata_id) REFERENCES metadata(id) ON DELETE CASCADE DEFERRABLE"
},
{
"Name": "series_points_original_repo_name_id_fkey",
"ConstraintType": "f",
"RefTableName": "repo_names",
"IsDeferrable": true,
"ConstraintDefinition": "FOREIGN KEY (original_repo_name_id) REFERENCES repo_names(id) ON DELETE CASCADE DEFERRABLE"
},
{
"Name": "series_points_repo_name_id_fkey",
"ConstraintType": "f",
"RefTableName": "repo_names",
"IsDeferrable": true,
"ConstraintDefinition": "FOREIGN KEY (repo_name_id) REFERENCES repo_names(id) ON DELETE CASCADE DEFERRABLE"
},
{
"Name": "series_points_tenant_id_fkey",
"ConstraintType": "f",
"RefTableName": "tenants",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON UPDATE CASCADE ON DELETE CASCADE"
}
],
"Triggers": []
},
{
"Name": "series_points_snapshots",
"Comment": "Stores ephemeral snapshot data of insight recordings.",
"Columns": [
{
"Name": "capture",
"Index": 8,
"TypeName": "text",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "metadata_id",
"Index": 4,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "original_repo_name_id",
"Index": 7,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "repo_id",
"Index": 5,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "repo_name_id",
"Index": 6,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "series_id",
"Index": 1,
"TypeName": "text",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "tenant_id",
"Index": 9,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "time",
"Index": 2,
"TypeName": "timestamp with time zone",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "value",
"Index": 3,
"TypeName": "double precision",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
}
],
"Indexes": [
{
"Name": "series_points_snapshots_original_repo_name_id_idx",
"IsPrimaryKey": false,
"IsUnique": false,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE INDEX series_points_snapshots_original_repo_name_id_idx ON series_points_snapshots USING btree (original_repo_name_id)",
"ConstraintType": "",
"ConstraintDefinition": ""
},
{
"Name": "series_points_snapshots_repo_id_idx",
"IsPrimaryKey": false,
"IsUnique": false,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE INDEX series_points_snapshots_repo_id_idx ON series_points_snapshots USING btree (repo_id)",
"ConstraintType": "",
"ConstraintDefinition": ""
},
{
"Name": "series_points_snapshots_repo_name_id_idx",
"IsPrimaryKey": false,
"IsUnique": false,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE INDEX series_points_snapshots_repo_name_id_idx ON series_points_snapshots USING btree (repo_name_id)",
"ConstraintType": "",
"ConstraintDefinition": ""
},
{
"Name": "series_points_snapshots_series_id_idx",
"IsPrimaryKey": false,
"IsUnique": false,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE INDEX series_points_snapshots_series_id_idx ON series_points_snapshots USING btree (series_id)",
"ConstraintType": "",
"ConstraintDefinition": ""
},
{
"Name": "series_points_snapshots_series_id_repo_id_time_idx",
"IsPrimaryKey": false,
"IsUnique": false,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE INDEX series_points_snapshots_series_id_repo_id_time_idx ON series_points_snapshots USING btree (series_id, repo_id, \"time\")",
"ConstraintType": "",
"ConstraintDefinition": ""
}
],
"Constraints": [
{
"Name": "check_repo_fields_specifity",
"ConstraintType": "c",
"RefTableName": "",
"IsDeferrable": false,
"ConstraintDefinition": "CHECK (repo_id IS NULL AND repo_name_id IS NULL AND original_repo_name_id IS NULL OR repo_id IS NOT NULL AND repo_name_id IS NOT NULL AND original_repo_name_id IS NOT NULL)"
},
{
"Name": "series_points_snapshots_tenant_id_fkey",
"ConstraintType": "f",
"RefTableName": "tenants",
"IsDeferrable": false,
"ConstraintDefinition": "FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON UPDATE CASCADE ON DELETE CASCADE"
}
],
"Triggers": []
},
{
"Name": "tenants",
"Comment": "The table that holds all tenants known to the instance. In enterprise instances, this table will only contain the \"default\" tenant.",
"Columns": [
{
"Name": "created_at",
"Index": 3,
"TypeName": "timestamp with time zone",
"IsNullable": false,
"Default": "now()",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "id",
"Index": 1,
"TypeName": "bigint",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "The ID of the tenant. To keep tenants globally addressable, and be able to move them aronud instances more easily, the ID is NOT a serial and has to be specified explicitly. The creator of the tenant is responsible for choosing a unique ID, if it cares."
},
{
"Name": "name",
"Index": 2,
"TypeName": "text",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "The name of the tenant. This may be displayed to the user and must be unique."
},
{
"Name": "updated_at",
"Index": 4,
"TypeName": "timestamp with time zone",
"IsNullable": false,
"Default": "now()",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
}
],
"Indexes": [
{
"Name": "tenants_name_key",
"IsPrimaryKey": false,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX tenants_name_key ON tenants USING btree (name)",
"ConstraintType": "u",
"ConstraintDefinition": "UNIQUE (name)"
},
{
"Name": "tenants_pkey",
"IsPrimaryKey": true,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX tenants_pkey ON tenants USING btree (id)",
"ConstraintType": "p",
"ConstraintDefinition": "PRIMARY KEY (id)"
}
],
"Constraints": [
{
"Name": "tenant_name_length",
"ConstraintType": "c",
"RefTableName": "",
"IsDeferrable": false,
"ConstraintDefinition": "CHECK (char_length(name) \u003c= 32 AND char_length(name) \u003e= 3)"
},
{
"Name": "tenant_name_valid_chars",
"ConstraintType": "c",
"RefTableName": "",
"IsDeferrable": false,
"ConstraintDefinition": "CHECK (name ~ '^[a-z](?:[a-z0-9\\_-])*[a-z0-9]$'::text)"
}
],
"Triggers": []
}
],
"Views": [
{
"Name": "insights_jobs_backfill_in_progress",
"Definition": " SELECT jobs.id,\n jobs.state,\n jobs.failure_message,\n jobs.queued_at,\n jobs.started_at,\n jobs.finished_at,\n jobs.process_after,\n jobs.num_resets,\n jobs.num_failures,\n jobs.last_heartbeat_at,\n jobs.execution_logs,\n jobs.worker_hostname,\n jobs.cancel,\n jobs.backfill_id,\n isb.state AS backfill_state,\n isb.estimated_cost,\n width_bucket(isb.estimated_cost, (0)::double precision, max((isb.estimated_cost + (1)::double precision)) OVER (), 4) AS cost_bucket\n FROM (insights_background_jobs jobs\n JOIN insight_series_backfill isb ON ((jobs.backfill_id = isb.id)))\n WHERE (isb.state = 'processing'::text);"
},
{
"Name": "insights_jobs_backfill_new",
"Definition": " SELECT jobs.id,\n jobs.state,\n jobs.failure_message,\n jobs.queued_at,\n jobs.started_at,\n jobs.finished_at,\n jobs.process_after,\n jobs.num_resets,\n jobs.num_failures,\n jobs.last_heartbeat_at,\n jobs.execution_logs,\n jobs.worker_hostname,\n jobs.cancel,\n jobs.backfill_id,\n isb.state AS backfill_state,\n isb.estimated_cost\n FROM (insights_background_jobs jobs\n JOIN insight_series_backfill isb ON ((jobs.backfill_id = isb.id)))\n WHERE (isb.state = 'new'::text);"
}
]
}