Skip to content

Commit

Permalink
Merge pull request #1516 from argos-ci/remove-unused-tables
Browse files Browse the repository at this point in the history
chore: remove crawls and captures table
  • Loading branch information
gregberge authored Jan 5, 2025
2 parents fa735fa + 6a943b8 commit b56bec3
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 299 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* @param {import('knex').Knex} knex
*/
export const up = async (knex) => {
await knex.schema.dropTable("captures");
await knex.schema.dropTable("crawls");
};

export const down = async () => {
throw new Error("There is no way to go back from hell 😈");
};
183 changes: 2 additions & 181 deletions apps/backend/db/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -296,82 +296,6 @@ ALTER TABLE public.builds_id_seq OWNER TO postgres;
ALTER SEQUENCE public.builds_id_seq OWNED BY public.builds.id;


--
-- Name: captures; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.captures (
id bigint NOT NULL,
"createdAt" timestamp with time zone NOT NULL,
"updatedAt" timestamp with time zone NOT NULL,
"jobStatus" public.job_status NOT NULL,
"crawlId" bigint NOT NULL,
"screenshotId" bigint,
"fileId" bigint,
url character varying(255) NOT NULL
);


ALTER TABLE public.captures OWNER TO postgres;

--
-- Name: captures_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.captures_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;


ALTER TABLE public.captures_id_seq OWNER TO postgres;

--
-- Name: captures_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.captures_id_seq OWNED BY public.captures.id;


--
-- Name: crawls; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.crawls (
id bigint NOT NULL,
"createdAt" timestamp with time zone NOT NULL,
"updatedAt" timestamp with time zone NOT NULL,
"jobStatus" public.job_status NOT NULL,
"buildId" bigint NOT NULL,
"baseUrl" character varying(255) NOT NULL
);


ALTER TABLE public.crawls OWNER TO postgres;

--
-- Name: crawls_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.crawls_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;


ALTER TABLE public.crawls_id_seq OWNER TO postgres;

--
-- Name: crawls_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.crawls_id_seq OWNED BY public.crawls.id;


--
-- Name: files; Type: TABLE; Schema: public; Owner: postgres
--
Expand Down Expand Up @@ -1436,20 +1360,6 @@ ALTER TABLE ONLY public.build_shards ALTER COLUMN id SET DEFAULT nextval('public
ALTER TABLE ONLY public.builds ALTER COLUMN id SET DEFAULT nextval('public.builds_id_seq'::regclass);


--
-- Name: captures id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.captures ALTER COLUMN id SET DEFAULT nextval('public.captures_id_seq'::regclass);


--
-- Name: crawls id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.crawls ALTER COLUMN id SET DEFAULT nextval('public.crawls_id_seq'::regclass);


--
-- Name: files id; Type: DEFAULT; Schema: public; Owner: postgres
--
Expand Down Expand Up @@ -1689,22 +1599,6 @@ ALTER TABLE ONLY public.builds
ADD CONSTRAINT builds_pkey PRIMARY KEY (id);


--
-- Name: captures captures_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.captures
ADD CONSTRAINT captures_pkey PRIMARY KEY (id);


--
-- Name: crawls crawls_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.crawls
ADD CONSTRAINT crawls_pkey PRIMARY KEY (id);


--
-- Name: files files_key_unique; Type: CONSTRAINT; Schema: public; Owner: postgres
--
Expand Down Expand Up @@ -2113,48 +2007,6 @@ CREATE INDEX builds_projectid_index ON public.builds USING btree ("projectId");
CREATE INDEX builds_runid_index ON public.builds USING btree ("runId");


--
-- Name: captures_crawlid_index; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX captures_crawlid_index ON public.captures USING btree ("crawlId");


--
-- Name: captures_fileid_index; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX captures_fileid_index ON public.captures USING btree ("fileId");


--
-- Name: captures_jobstatus_index; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX captures_jobstatus_index ON public.captures USING btree ("jobStatus");


--
-- Name: captures_screenshotid_index; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX captures_screenshotid_index ON public.captures USING btree ("screenshotId");


--
-- Name: crawls_buildid_index; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX crawls_buildid_index ON public.crawls USING btree ("buildId");


--
-- Name: crawls_jobstatus_index; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX crawls_jobstatus_index ON public.crawls USING btree ("jobStatus");


--
-- Name: github_account_members_githubaccountid_index; Type: INDEX; Schema: public; Owner: postgres
--
Expand Down Expand Up @@ -2575,38 +2427,6 @@ ALTER TABLE ONLY public.builds
ADD CONSTRAINT builds_projectid_foreign FOREIGN KEY ("projectId") REFERENCES public.projects(id);


--
-- Name: captures captures_crawlid_foreign; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.captures
ADD CONSTRAINT captures_crawlid_foreign FOREIGN KEY ("crawlId") REFERENCES public.crawls(id);


--
-- Name: captures captures_fileid_foreign; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.captures
ADD CONSTRAINT captures_fileid_foreign FOREIGN KEY ("fileId") REFERENCES public.files(id);


--
-- Name: captures captures_screenshotid_foreign; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.captures
ADD CONSTRAINT captures_screenshotid_foreign FOREIGN KEY ("screenshotId") REFERENCES public.screenshots(id);


--
-- Name: crawls crawls_buildid_foreign; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.crawls
ADD CONSTRAINT crawls_buildid_foreign FOREIGN KEY ("buildId") REFERENCES public.builds(id);


--
-- Name: github_account_members github_account_members_githubaccountid_foreign; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
Expand Down Expand Up @@ -3010,4 +2830,5 @@ INSERT INTO public.knex_migrations(name, batch, migration_time) VALUES ('2024121
INSERT INTO public.knex_migrations(name, batch, migration_time) VALUES ('20241231154644_build-status.js', 1, NOW());
INSERT INTO public.knex_migrations(name, batch, migration_time) VALUES ('20250102150800_build-review.js', 1, NOW());
INSERT INTO public.knex_migrations(name, batch, migration_time) VALUES ('20250103090503_remove-validation-status-column.js', 1, NOW());
INSERT INTO public.knex_migrations(name, batch, migration_time) VALUES ('20250103131406_plan-interval.js', 1, NOW());
INSERT INTO public.knex_migrations(name, batch, migration_time) VALUES ('20250103131406_plan-interval.js', 1, NOW());
INSERT INTO public.knex_migrations(name, batch, migration_time) VALUES ('20250105130307_remove-crawls-captures.js', 1, NOW());
65 changes: 0 additions & 65 deletions apps/backend/src/database/models/Capture.ts

This file was deleted.

41 changes: 0 additions & 41 deletions apps/backend/src/database/models/Crawl.ts

This file was deleted.

2 changes: 0 additions & 2 deletions apps/backend/src/database/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ export * from "./Build.js";
export * from "./BuildShard.js";
export * from "./BuildNotification.js";
export * from "./BuildReview.js";
export * from "./Capture.js";
export * from "./Crawl.js";
export * from "./File.js";
export * from "./GithubAccount.js";
export * from "./GithubAccountMember.js";
Expand Down
10 changes: 0 additions & 10 deletions apps/backend/src/graphql/services/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import {
Build,
BuildNotification,
BuildReview,
Capture,
Crawl,
Project,
Screenshot,
ScreenshotBucket,
Expand Down Expand Up @@ -57,14 +55,6 @@ export async function unsafe_deleteProject(args: {
trx?: TransactionOrKnex;
}) {
await transaction(args.trx, async (trx) => {
await Capture.query(trx)
.joinRelated("crawl.build")
.where("crawl:build.projectId", args.projectId)
.delete();
await Crawl.query(trx)
.joinRelated("build")
.where("build.projectId", args.projectId)
.delete();
await ScreenshotDiff.query(trx)
.joinRelated("build")
.where("build.projectId", args.projectId)
Expand Down

0 comments on commit b56bec3

Please sign in to comment.