Skip to content

Cleanup columns in forges table#5517

Merged
anbraten merged 2 commits into
mainfrom
forges-table
Sep 16, 2025
Merged

Cleanup columns in forges table#5517
anbraten merged 2 commits into
mainfrom
forges-table

Conversation

@xoxys

@xoxys xoxys commented Sep 16, 2025

Copy link
Copy Markdown
Member

Stumbled across this while looking into #5471. Would like to get the cleanup done first before working on this issue.

Changes:

  • fix oauth column names
  • drop old client and client_sectret columns

Before:

❯ docker exec -it woodpecker-db psql -U postgres -d woodpecker_server -c "\d+ forges"
                                                                      Table "public.forges"
        Column        |          Type          | Collation | Nullable |              Default               | Storage  | Compression | Stats target | Description
----------------------+------------------------+-----------+----------+------------------------------------+----------+-------------+--------------+-------------
 id                   | bigint                 |           | not null | nextval('forges_id_seq'::regclass) | plain    |             |              |
 type                 | character varying(250) |           |          |                                    | extended |             |              |
 url                  | character varying(500) |           |          |                                    | extended |             |              |
 client               | character varying(250) |           |          |                                    | extended |             |              |
 client_secret        | character varying(250) |           |          |                                    | extended |             |              |
 skip_verify          | boolean                |           |          |                                    | plain    |             |              |
 oauth_host           | character varying(250) |           |          |                                    | extended |             |              |
 additional_options   | json                   |           |          |                                    | extended |             |              |
 o_auth_client_i_d    | character varying(250) |           |          |                                    | extended |             |              |
 o_auth_client_secret | character varying(250) |           |          |                                    | extended |             |              |
Indexes:
    "forges_pkey" PRIMARY KEY, btree (id)
Access method: heap

After:

❯ docker exec -it woodpecker-db psql -U postgres -d woodpecker_server -c "\d+ forges"
                                                                     Table "public.forges"
       Column        |          Type          | Collation | Nullable |              Default               | Storage  | Compression | Stats target | Description
---------------------+------------------------+-----------+----------+------------------------------------+----------+-------------+--------------+-------------
 id                  | bigint                 |           | not null | nextval('forges_id_seq'::regclass) | plain    |             |              |
 type                | character varying(250) |           |          |                                    | extended |             |              |
 url                 | character varying(500) |           |          |                                    | extended |             |              |
 skip_verify         | boolean                |           |          |                                    | plain    |             |              |
 oauth_host          | character varying(250) |           |          |                                    | extended |             |              |
 additional_options  | json                   |           |          |                                    | extended |             |              |
 oauth_client_id     | character varying(250) |           |          |                                    | extended |             |              |
 oauth_client_secret | character varying(250) |           |          |                                    | extended |             |              |
Indexes:
    "forges_pkey" PRIMARY KEY, btree (id)
Access method: heap

The values that exist in the old columns client and client_secret were already present in the related oauth_* so I just dropped the old ones.

❯ docker exec -it woodpecker-db psql -U postgres -d woodpecker_server -c "select * from forges"
 id |     type     |             url              | skip_verify | oauth_host | additional_options |           oauth_client_id            |                   oauth_client_secret
----+--------------+------------------------------+-------------+------------+--------------------+--------------------------------------+----------------------------------------------------------
  3 | bitbucket-dc | https://myurl                | f           |            | null               | asasas                               |
  1 | gitea        | http://woodpecker-gitea:3000 | f           |            | {}                 | bc5fe614-***                         | gto_***
(2 rows)

@xoxys xoxys added refactor delete or replace old code server labels Sep 16, 2025
@xoxys xoxys requested a review from a team September 16, 2025 08:56
@xoxys

xoxys commented Sep 16, 2025

Copy link
Copy Markdown
Member Author

The 027 migration is intentional due to 026 migration in #5516

@codecov

codecov Bot commented Sep 16, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 18.18182% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 26.41%. Comparing base (47a0005) to head (021628e).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
...store/datastore/migration/027_fix_forge_columns.go 18.18% 6 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5517      +/-   ##
==========================================
- Coverage   26.42%   26.41%   -0.01%     
==========================================
  Files         404      405       +1     
  Lines       28858    28869      +11     
==========================================
+ Hits         7625     7627       +2     
- Misses      20538    20544       +6     
- Partials      695      698       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@anbraten anbraten merged commit d69fdff into main Sep 16, 2025
8 of 9 checks passed
@anbraten anbraten deleted the forges-table branch September 16, 2025 09:50
@woodpecker-bot woodpecker-bot mentioned this pull request Sep 16, 2025
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor delete or replace old code server

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants