insights: remove deprecated dirty_queries table (#45714)

This commit is contained in:
leo 2023-01-23 15:58:08 +00:00 committed by GitHub
parent a028581141
commit 80e3c0b2f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 30 additions and 193 deletions

View File

@ -66,15 +66,6 @@
"Increment": 1,
"CycleOption": "NO"
},
{
"Name": "insight_dirty_queries_id_seq",
"TypeName": "integer",
"StartValue": 1,
"MinimumValue": 1,
"MaximumValue": 2147483647,
"Increment": 1,
"CycleOption": "NO"
},
{
"Name": "insight_series_backfill_id_seq",
"TypeName": "integer",
@ -882,122 +873,6 @@
],
"Triggers": []
},
{
"Name": "insight_dirty_queries",
"Comment": "Stores queries that were unsuccessful or otherwise flagged as incomplete or incorrect.",
"Columns": [
{
"Name": "dirty_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 query was marked dirty."
},
{
"Name": "for_time",
"Index": 6,
"TypeName": "timestamp without time zone",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "Timestamp for which the original data point was recorded or intended to be recorded."
},
{
"Name": "id",
"Index": 1,
"TypeName": "integer",
"IsNullable": false,
"Default": "nextval('insight_dirty_queries_id_seq'::regclass)",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "insight_series_id",
"Index": 2,
"TypeName": "integer",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "query",
"Index": 3,
"TypeName": "text",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "Sourcegraph query string that was executed."
},
{
"Name": "reason",
"Index": 5,
"TypeName": "text",
"IsNullable": false,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": "Human readable string indicating the reason the query was marked dirty."
}
],
"Indexes": [
{
"Name": "insight_dirty_queries_pkey",
"IsPrimaryKey": true,
"IsUnique": true,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE UNIQUE INDEX insight_dirty_queries_pkey ON insight_dirty_queries USING btree (id)",
"ConstraintType": "p",
"ConstraintDefinition": "PRIMARY KEY (id)"
},
{
"Name": "insight_dirty_queries_insight_series_id_fk_idx",
"IsPrimaryKey": false,
"IsUnique": false,
"IsExclusion": false,
"IsDeferrable": false,
"IndexDefinition": "CREATE INDEX insight_dirty_queries_insight_series_id_fk_idx ON insight_dirty_queries USING btree (insight_series_id)",
"ConstraintType": "",
"ConstraintDefinition": ""
}
],
"Constraints": [
{
"Name": "insight_dirty_queries_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": "insight_series",
"Comment": "Data series that comprise code insights.",

View File

@ -137,34 +137,6 @@ Foreign-key constraints:
```
# Table "public.insight_dirty_queries"
```
Column | Type | Collation | Nullable | Default
-------------------+-----------------------------+-----------+----------+---------------------------------------------------
id | integer | | not null | nextval('insight_dirty_queries_id_seq'::regclass)
insight_series_id | integer | | |
query | text | | not null |
dirty_at | timestamp without time zone | | not null | CURRENT_TIMESTAMP
reason | text | | not null |
for_time | timestamp without time zone | | not null |
Indexes:
"insight_dirty_queries_pkey" PRIMARY KEY, btree (id)
"insight_dirty_queries_insight_series_id_fk_idx" btree (insight_series_id)
Foreign-key constraints:
"insight_dirty_queries_insight_series_id_fkey" FOREIGN KEY (insight_series_id) REFERENCES insight_series(id) ON DELETE CASCADE
```
Stores queries that were unsuccessful or otherwise flagged as incomplete or incorrect.
**dirty_at**: Timestamp when this query was marked dirty.
**for_time**: Timestamp for which the original data point was recorded or intended to be recorded.
**query**: Sourcegraph query string that was executed.
**reason**: Human readable string indicating the reason the query was marked dirty.
# Table "public.insight_series"
```
Column | Type | Collation | Nullable | Default
@ -198,7 +170,6 @@ Indexes:
"insight_series_deleted_at_idx" btree (deleted_at)
"insight_series_next_recording_after_idx" btree (next_recording_after)
Referenced by:
TABLE "insight_dirty_queries" CONSTRAINT "insight_dirty_queries_insight_series_id_fkey" FOREIGN KEY (insight_series_id) REFERENCES insight_series(id) ON DELETE CASCADE
TABLE "insight_series_backfill" CONSTRAINT "insight_series_backfill_series_id_fk" FOREIGN KEY (series_id) REFERENCES insight_series(id) ON DELETE CASCADE
TABLE "archived_insight_series_recording_times" CONSTRAINT "insight_series_id_fkey" FOREIGN KEY (insight_series_id) REFERENCES insight_series(id) ON DELETE CASCADE
TABLE "insight_series_recording_times" CONSTRAINT "insight_series_id_fkey" FOREIGN KEY (insight_series_id) REFERENCES insight_series(id) ON DELETE CASCADE

View File

@ -0,0 +1,27 @@
CREATE TABLE IF NOT EXISTS insight_dirty_queries (
id integer PRIMARY KEY,
insight_series_id integer,
query text NOT NULL,
dirty_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
reason text NOT NULL,
for_time timestamp without time zone NOT NULL
);
CREATE SEQUENCE IF NOT EXISTS insight_dirty_queries_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE IF EXISTS insight_dirty_queries_id_seq OWNED BY insight_dirty_queries.id;
ALTER TABLE IF EXISTS insight_dirty_queries ALTER COLUMN id SET DEFAULT nextval('insight_dirty_queries_id_seq'::regclass);
ALTER TABLE IF EXISTS insight_dirty_queries DROP CONSTRAINT IF EXISTS insight_dirty_queries_insight_series_id_fkey;
ALTER TABLE IF EXISTS insight_dirty_queries
ADD CONSTRAINT insight_dirty_queries_insight_series_id_fkey FOREIGN KEY (insight_series_id) REFERENCES insight_series(id) ON DELETE CASCADE;
CREATE INDEX IF NOT EXISTS insight_dirty_queries_insight_series_id_fk_idx ON insight_dirty_queries USING btree (insight_series_id);

View File

@ -0,0 +1,2 @@
name: remove_dirty_queries_table
parents: [1672921606]

View File

@ -0,0 +1 @@
DROP TABLE IF EXISTS insight_dirty_queries;

View File

@ -138,35 +138,6 @@ CREATE SEQUENCE dashboard_insight_view_id_seq
ALTER SEQUENCE dashboard_insight_view_id_seq OWNED BY dashboard_insight_view.id;
CREATE TABLE insight_dirty_queries (
id integer NOT NULL,
insight_series_id integer,
query text NOT NULL,
dirty_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
reason text NOT NULL,
for_time timestamp without time zone NOT NULL
);
COMMENT ON TABLE insight_dirty_queries IS 'Stores queries that were unsuccessful or otherwise flagged as incomplete or incorrect.';
COMMENT ON COLUMN insight_dirty_queries.query IS 'Sourcegraph query string that was executed.';
COMMENT ON COLUMN insight_dirty_queries.dirty_at IS 'Timestamp when this query was marked dirty.';
COMMENT ON COLUMN insight_dirty_queries.reason IS 'Human readable string indicating the reason the query was marked dirty.';
COMMENT ON COLUMN insight_dirty_queries.for_time IS 'Timestamp for which the original data point was recorded or intended to be recorded.';
CREATE SEQUENCE insight_dirty_queries_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE insight_dirty_queries_id_seq OWNED BY insight_dirty_queries.id;
CREATE TABLE insight_series (
id integer NOT NULL,
series_id text NOT NULL,
@ -581,8 +552,6 @@ ALTER TABLE ONLY dashboard_grants ALTER COLUMN id SET DEFAULT nextval('dashboard
ALTER TABLE ONLY dashboard_insight_view ALTER COLUMN id SET DEFAULT nextval('dashboard_insight_view_id_seq'::regclass);
ALTER TABLE ONLY insight_dirty_queries ALTER COLUMN id SET DEFAULT nextval('insight_dirty_queries_id_seq'::regclass);
ALTER TABLE ONLY insight_series ALTER COLUMN id SET DEFAULT nextval('insight_series_id_seq'::regclass);
ALTER TABLE ONLY insight_series_backfill ALTER COLUMN id SET DEFAULT nextval('insight_series_backfill_id_seq'::regclass);
@ -623,9 +592,6 @@ ALTER TABLE ONLY dashboard_insight_view
ALTER TABLE ONLY dashboard
ADD CONSTRAINT dashboard_pk PRIMARY KEY (id);
ALTER TABLE ONLY insight_dirty_queries
ADD CONSTRAINT insight_dirty_queries_pkey PRIMARY KEY (id);
ALTER TABLE ONLY insight_series_backfill
ADD CONSTRAINT insight_series_backfill_pk PRIMARY KEY (id);
@ -682,8 +648,6 @@ CREATE INDEX dashboard_insight_view_dashboard_id_fk_idx ON dashboard_insight_vie
CREATE INDEX dashboard_insight_view_insight_view_id_fk_idx ON dashboard_insight_view USING btree (insight_view_id);
CREATE INDEX insight_dirty_queries_insight_series_id_fk_idx ON insight_dirty_queries USING btree (insight_series_id);
CREATE INDEX insight_series_deleted_at_idx ON insight_series USING btree (deleted_at);
CREATE UNIQUE INDEX insight_series_incomplete_points_unique_idx ON insight_series_incomplete_points USING btree (series_id, reason, "time", repo_id);
@ -743,9 +707,6 @@ ALTER TABLE ONLY dashboard_insight_view
ALTER TABLE ONLY dashboard_insight_view
ADD CONSTRAINT dashboard_insight_view_insight_view_id_fk FOREIGN KEY (insight_view_id) REFERENCES insight_view(id) ON DELETE CASCADE;
ALTER TABLE ONLY insight_dirty_queries
ADD CONSTRAINT insight_dirty_queries_insight_series_id_fkey FOREIGN KEY (insight_series_id) REFERENCES insight_series(id) ON DELETE CASCADE;
ALTER TABLE ONLY insight_series_backfill
ADD CONSTRAINT insight_series_backfill_series_id_fk FOREIGN KEY (series_id) REFERENCES insight_series(id) ON DELETE CASCADE;