feat: implement database schema for merge freeze windows (#819) - #824
Open
desireddymohithreddy0925 wants to merge 2 commits into
Open
Conversation
Contributor
|
Someone is attempting to deploy a commit to the codersogs-3057's projects Team on Vercel. A member of the Team first needs to authorize it. |
jakharmonika364
requested changes
Jul 28, 2026
jakharmonika364
left a comment
Collaborator
There was a problem hiding this comment.
New file supabase/migrations/0044_merge_freeze_windows.sql (next number after 0043_activity_log_read_at.sql) - creates the table and locks it down like installation_settings:
create table merge_freeze_windows (
id uuid primary key default gen_random_uuid(),
installation_id bigint not null references github_installations(id) on delete cascade,
cron_schedule text,
is_emergency_freeze boolean not null default false,
freeze_message text,
created_at timestamptz not null default now(),
updated_at timestamptz not null default now()
);
create index merge_freeze_windows_installation_idx on merge_freeze_windows(installation_id);
alter table merge_freeze_windows enable row level security;
create policy merge_freeze_windows_admin_rw on merge_freeze_windows
for all
using (
exists (
select 1 from github_installation_users giu
where giu.installation_id = merge_freeze_windows.installation_id
and giu.user_id = auth.uid()
and giu.permission_level in ('org_admin', 'repo_admin')
)
)
with check (
exists (
select 1 from github_installation_users giu
where giu.installation_id = merge_freeze_windows.installation_id
and giu.user_id = auth.uid()
and giu.permission_level in ('org_admin', 'repo_admin')
)
);
Comment on lines
+755
to
+765
| export const mergeFreezeWindows = pgTable('merge_freeze_windows', { | ||
| id: uuid('id').primaryKey().defaultRandom(), | ||
| installationId: bigint('installation_id', { mode: 'number' }) | ||
| .notNull() | ||
| .references(() => githubInstallations.id, { onDelete: 'cascade' }), | ||
| cronSchedule: text('cron_schedule'), | ||
| isEmergencyFreeze: boolean('is_emergency_freeze').notNull().default(false), | ||
| freezeMessage: text('freeze_message'), | ||
| createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(), | ||
| updatedAt: timestamp('updated_at', { withTimezone: true }).notNull().defaultNow(), | ||
| }); |
Collaborator
There was a problem hiding this comment.
Change the table to the 3-arg form and add an installation index (matches orgCommunities/flaggedAccounts pattern):
Suggested change
| export const mergeFreezeWindows = pgTable('merge_freeze_windows', { | |
| id: uuid('id').primaryKey().defaultRandom(), | |
| installationId: bigint('installation_id', { mode: 'number' }) | |
| .notNull() | |
| .references(() => githubInstallations.id, { onDelete: 'cascade' }), | |
| cronSchedule: text('cron_schedule'), | |
| isEmergencyFreeze: boolean('is_emergency_freeze').notNull().default(false), | |
| freezeMessage: text('freeze_message'), | |
| createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(), | |
| updatedAt: timestamp('updated_at', { withTimezone: true }).notNull().defaultNow(), | |
| }); | |
| export const mergeFreezeWindows = pgTable( | |
| 'merge_freeze_windows', | |
| { | |
| id: uuid('id').primaryKey().defaultRandom(), | |
| installationId: bigint('installation_id', { mode: 'number' }) | |
| .notNull() | |
| .references(() => githubInstallations.id, { onDelete: 'cascade' }), | |
| cronSchedule: text('cron_schedule'), | |
| isEmergencyFreeze: boolean('is_emergency_freeze').notNull().default(false), | |
| freezeMessage: text('freeze_message'), | |
| createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(), | |
| updatedAt: timestamp('updated_at', { withTimezone: true }).notNull().defaultNow(), | |
| }, | |
| (t) => ({ | |
| installationIdx: index('merge_freeze_windows_installation_idx').on(t.installationId), | |
| }), | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #819
Description
This PR implements the database schema required for the Configurable Merge Freeze Windows feature.
Changes Made
merge_freeze_windowstable tosrc/lib/db/schema.tsgithubInstallationsfor repository-level configurationcronSchedule,isEmergencyFreeze, and customfreezeMessageNext Steps
This serves as the foundational data layer. Subsequent PRs will implement the UI settings panel and the backend middleware to block the merge API requests.
Screenshots / UI Thoughts
No UI changes in this PR as this is the backend schema foundation.