From 95cc472037fcb3207b510e67f1a44af4e2a2cae9 Mon Sep 17 00:00:00 2001
From: Ellie Huxtable <ellie@elliehuxtable.com>
Date: Thu, 18 Apr 2024 16:41:28 +0100
Subject: chore: move crates into crates/ dir (#1958)

I'd like to tidy up the root a little, and it's nice to have all the
rust crates in one place
---
 .../20220421073605_fix_count_trigger_delete.sql    | 35 ----------------------
 1 file changed, 35 deletions(-)
 delete mode 100644 atuin-server-postgres/migrations/20220421073605_fix_count_trigger_delete.sql

(limited to 'atuin-server-postgres/migrations/20220421073605_fix_count_trigger_delete.sql')

diff --git a/atuin-server-postgres/migrations/20220421073605_fix_count_trigger_delete.sql b/atuin-server-postgres/migrations/20220421073605_fix_count_trigger_delete.sql
deleted file mode 100644
index 6198f300..00000000
--- a/atuin-server-postgres/migrations/20220421073605_fix_count_trigger_delete.sql
+++ /dev/null
@@ -1,35 +0,0 @@
--- the old version of this function used NEW in the delete part when it should
--- use OLD
-
-create or replace function user_history_count()
-returns trigger as 
-$func$
-begin
-	if (TG_OP='INSERT') then
-		update total_history_count_user set total = total + 1 where user_id = new.user_id;
-
-		if not found then
-			insert into total_history_count_user(user_id, total) 
-			values (
-				new.user_id, 
-				(select count(1) from history where user_id = new.user_id)
-			);
-		end if;
-		
-	elsif (TG_OP='DELETE') then
-		update total_history_count_user set total = total - 1 where user_id = old.user_id;
-
-		if not found then
-			insert into total_history_count_user(user_id, total) 
-			values (
-				old.user_id, 
-				(select count(1) from history where user_id = old.user_id)
-			);
-		end if;
-	end if;
-
-	return NEW; -- this is actually ignored for an after trigger, but oh well
-end;
-$func$
-language plpgsql volatile -- pldfplplpflh
-cost 100; -- default value
-- 
cgit v1.3.1

