Skip to content

Commit

Permalink
Adds migration to remove repo_status from gitserver_repos (source…
Browse files Browse the repository at this point in the history
…graph#44299)

* Adds migration to remove repo_status from gitserver_repos
- Reference issue here: sourcegraph#44009

* Update migrations/frontend/1668184279_remove_git_status_column_from_gitserver_repos_table/up.sql

Co-authored-by: Erik Seliger <[email protected]>

* Update down.sql

Co-authored-by: Erik Seliger <[email protected]>
  • Loading branch information
jasonhawkharris and eseliger committed Nov 11, 2022
1 parent 43ab26e commit 15c2723
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 16 deletions.
13 changes: 0 additions & 13 deletions internal/database/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -10664,19 +10664,6 @@
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "repo_status",
"Index": 9,
"TypeName": "text",
"IsNullable": true,
"Default": "",
"CharacterMaximumLength": 0,
"IsIdentity": false,
"IdentityGeneration": "",
"IsGenerated": "NEVER",
"GenerationExpression": "",
"Comment": ""
},
{
"Name": "shard_id",
"Index": 3,
Expand Down
1 change: 0 additions & 1 deletion internal/database/schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -1468,7 +1468,6 @@ Indexes:
last_fetched | timestamp with time zone | | not null | now()
last_changed | timestamp with time zone | | not null | now()
repo_size_bytes | bigint | | |
repo_status | text | | |
Indexes:
"gitserver_repos_pkey" PRIMARY KEY, btree (repo_id)
"gitserver_repos_cloned_status_idx" btree (repo_id) WHERE clone_status = 'cloned'::text
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- Undo the changes made in the up migration
ALTER TABLE gitserver_repos
ADD COLUMN IF NOT EXISTS repo_status text;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
name: remove git_status column from gitserver_repos table
parents: [1668174127]
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
-- Perform migration here.
--
-- See /migrations/README.md. Highlights:
-- * Make migrations idempotent (use IF EXISTS)
-- * Make migrations backwards-compatible (old readers/writers must continue to work)
-- * If you are using CREATE INDEX CONCURRENTLY, then make sure that only one statement
-- is defined per file, and that each such statement is NOT wrapped in a transaction.
-- Each such migration must also declare "createIndexConcurrently: true" in their
-- associated metadata.yaml file.
-- * If you are modifying Postgres extensions, you must also declare "privileged: true"
-- in the associated metadata.yaml file.

ALTER TABLE gitserver_repos DROP COLUMN IF EXISTS repo_status;
3 changes: 1 addition & 2 deletions migrations/frontend/squashed.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2168,8 +2168,7 @@ CREATE TABLE gitserver_repos (
updated_at timestamp with time zone DEFAULT now() NOT NULL,
last_fetched timestamp with time zone DEFAULT now() NOT NULL,
last_changed timestamp with time zone DEFAULT now() NOT NULL,
repo_size_bytes bigint,
repo_status text
repo_size_bytes bigint
);

CREATE TABLE gitserver_repos_statistics (
Expand Down

0 comments on commit 15c2723

Please sign in to comment.