Skip to content

Commit

Permalink
chore: state fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Vilsol committed Oct 2, 2024
1 parent fe5f5c0 commit 1cb362e
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion db/schema/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func (Version) Fields() []ent.Field {
field.String("mod_id"),
field.String("version").MaxLen(16),
field.String("game_version"),
field.Bool("required_on_remote"),
field.Bool("required_on_remote").Default(true),
field.String("changelog").Optional(),
field.Uint("downloads").Default(0),
field.String("key").Optional(),
Expand Down
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module github.com/satisfactorymodding/smr-api

go 1.22.3
go 1.22.5

toolchain go1.23.0

require (
ariga.io/entcache v0.1.0
Expand Down
16 changes: 16 additions & 0 deletions migrations/sql/20241002191358_state_fix.down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
-- reverse: drop "generate_random_id" function
CREATE FUNCTION "generate_random_id" ("length" integer) RETURNS text LANGUAGE plpgsql AS $$
declare
chars text[] := '{0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}';
result text := '';
i integer := 0;
begin
if length < 0 then
raise exception 'Given length cannot be less than 0';
end if;
for i in 1..length loop
result := result || chars[1+random()*(array_length(chars, 1)-1)];
end loop;
return result;
end;
$$;
2 changes: 2 additions & 0 deletions migrations/sql/20241002191358_state_fix.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- drop "generate_random_id" function
DROP FUNCTION "generate_random_id";
4 changes: 3 additions & 1 deletion migrations/sql/atlas.sum
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
h1:y/Q8pNjcrL7pi8F3JUxIBsFUtvbWFdFKmH3sqWVr3zs=
h1:67tUWb0QFZPzh+o8osVd09uCPAo5q/JBGeWwsNVV+PQ=
000001_create_initial_tables.down.sql h1:QcXXwE8ir3PM3vZjQfBihY55WiuLYjN8pbbk/L6U+bs=
000001_create_initial_tables.up.sql h1:EfAqETefs7TW9BDVS4ukiB7wUFs+HQzVdc3qHhdAFd4=
000002_create_user_group_table.down.sql h1:uJjRbQ3H7yvPGNXLD5iSPmderEoWhCNGdsqN8yqBIRY=
Expand Down Expand Up @@ -73,3 +73,5 @@ h1:y/Q8pNjcrL7pi8F3JUxIBsFUtvbWFdFKmH3sqWVr3zs=
20240826153722_add_thumbhash.up.sql h1:7a9d40zpOnKMamxW14ql3WFXiwXD4O6AjwMlAOVE7ik=
20240930114249_add_required_on_remote.down.sql h1:cbW5+35gg4R78zsjcqPO94e8X1QcYB9nPllGgtKGOr8=
20240930114249_add_required_on_remote.up.sql h1:NZJmXjtKEIHRhVlSSu9nKADo/8xhZAeckrf6NoZMmjk=
20241002191358_state_fix.down.sql h1:EnNOr58ajtIPS7BIgA6l60Jr8hE0ufCE6t0zFdvfnaw=
20241002191358_state_fix.up.sql h1:4bVw9fxEP9MrHBSYuRF3vFCgaWF79EUeacD3e+vSQR4=

0 comments on commit 1cb362e

Please sign in to comment.