Skip to content

Commit f30723e

Browse files
committed
fixes migrations
1 parent 92f08f7 commit f30723e

8 files changed

Lines changed: 11 additions & 29 deletions

internal/database/migrations/20250801103400_migration.down.sql

Whitespace-only changes.

internal/database/migrations/0000_migration.sql renamed to internal/database/migrations/20250801103400_migration.up.sql

File renamed without changes.

internal/database/migrations/20250801103405_add_cascade_delete_project_enabled_policies.down.sql

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,3 @@
1313
-- You should have received a copy of the GNU Affero General Public License
1414
-- along with this program. If not, see <https://www.gnu.org/licenses/>.
1515

16-
-- Down migration: Revert cascade delete constraint on project_enabled_policies table
17-
-- This removes the CASCADE DELETE behavior and restores the original foreign key constraints
18-
19-
-- Drop the CASCADE DELETE foreign key constraints
20-
ALTER TABLE project_enabled_policies
21-
DROP CONSTRAINT IF EXISTS fk_project_enabled_policies_project;
22-
23-
ALTER TABLE project_enabled_policies
24-
DROP CONSTRAINT IF EXISTS fk_project_enabled_policies_policy;
25-
26-
-- Add back the original foreign key constraints without CASCADE DELETE
27-
ALTER TABLE project_enabled_policies
28-
ADD CONSTRAINT fk_project_enabled_policies_project
29-
FOREIGN KEY (project_id) REFERENCES projects(id);
30-
31-
ALTER TABLE project_enabled_policies
32-
ADD CONSTRAINT fk_project_enabled_policies_policy
33-
FOREIGN KEY (policy_id) REFERENCES policies(id);

internal/database/migrations/20250801103405_add_cascade_delete_project_enabled_policies.up.sql

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,18 @@
1717
-- This ensures that when a project is deleted, all related entries in the project_enabled_policies join table are automatically deleted
1818

1919
-- Drop existing foreign key constraints (if they exist)
20-
ALTER TABLE project_enabled_policies
20+
ALTER TABLE public.project_enabled_policies
2121
DROP CONSTRAINT IF EXISTS fk_project_enabled_policies_project;
2222

23-
ALTER TABLE project_enabled_policies
23+
ALTER TABLE public.project_enabled_policies
2424
DROP CONSTRAINT IF EXISTS fk_project_enabled_policies_policy;
2525

2626
-- Add the foreign key constraint for project_id with CASCADE DELETE
27-
ALTER TABLE project_enabled_policies
27+
ALTER TABLE public.project_enabled_policies
2828
ADD CONSTRAINT fk_project_enabled_policies_project
29-
FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
29+
FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE;
3030

3131
-- Add the foreign key constraint for policy_id with CASCADE DELETE
32-
ALTER TABLE project_enabled_policies
32+
ALTER TABLE public.project_enabled_policies
3333
ADD CONSTRAINT fk_project_enabled_policies_policy
34-
FOREIGN KEY (policy_id) REFERENCES policies(id) ON DELETE CASCADE;
34+
FOREIGN KEY (policy_id) REFERENCES public.policies(id) ON DELETE CASCADE;

internal/database/migrations/20250801111615_code_risks_multiple_snippets.up.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
-- You should have received a copy of the GNU Affero General Public License
1414
-- along with this program. If not, see <https://www.gnu.org/licenses/>.
1515

16-
ALTER TABLE first_party_vulnerabilities
16+
ALTER TABLE public.first_party_vulnerabilities
1717
ADD COLUMN snippet_contents JSONB;
1818

19-
UPDATE first_party_vulnerabilities
19+
UPDATE public.first_party_vulnerabilities
2020
SET snippet_contents = jsonb_build_object(
2121
'snippets', jsonb_build_array(
2222
jsonb_build_object(

internal/database/migrations/20250801115325_add_fingerprint_column.up.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
-- You should have received a copy of the GNU Affero General Public License
1414
-- along with this program. If not, see <https://www.gnu.org/licenses/>.
1515

16-
ALTER TABLE first_party_vulnerabilities
16+
ALTER TABLE public.first_party_vulnerabilities
1717
ADD COLUMN IF NOT EXISTS fingerprint text;

internal/database/migrations/20250801170509_add_shares_vuln_information_column.up.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
-- You should have received a copy of the GNU Affero General Public License
1414
-- along with this program. If not, see <https://www.gnu.org/licenses/>.
1515

16-
ALTER TABLE organizations
16+
ALTER TABLE public.organizations
1717
ADD COLUMN IF NOT EXISTS shares_vuln_information boolean NOT NULL DEFAULT false;

internal/database/migrations/20250802184646_add_vuln_auto_reopen_after_days.up.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
-- You should have received a copy of the GNU Affero General Public License
1414
-- along with this program. If not, see <https://www.gnu.org/licenses/>.
1515

16-
ALTER TABLE assets
16+
ALTER TABLE public.assets
1717
ADD COLUMN IF NOT EXISTS vuln_auto_reopen_after_days int;

0 commit comments

Comments
 (0)