Skip to content

Commit

Permalink
Merge pull request #32 from brimstone/add-function_get_player_symbol
Browse files Browse the repository at this point in the history
Add function get_player_symbol()

Woo! Thanks for the bug fix :)
  • Loading branch information
Abstrct committed Dec 9, 2016
2 parents ea14015 + e80e5f4 commit a98c436
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
26 changes: 26 additions & 0 deletions schema/deploy/function-get_player_symbol.sql
@@ -0,0 +1,26 @@
-- Deploy schemaverse:function-get_player_symbol to pg
-- requires: table-player

BEGIN;

CREATE OR REPLACE FUNCTION public.get_player_symbol(check_id integer)
RETURNS character
LANGUAGE sql
STABLE SECURITY DEFINER
AS $function$
SELECT symbol FROM public.player WHERE id=$1;
$function$;


CREATE OR REPLACE FUNCTION public.get_player_symbol(check_username name)
RETURNS character
LANGUAGE sql
STABLE SECURITY DEFINER
AS $function$
SELECT symbol FROM public.player WHERE username=$1;
$function$;

GRANT EXECUTE ON FUNCTION public.get_player_symbol(integer) TO players;
GRANT EXECUTE ON FUNCTION public.get_player_symbol(name) TO players;

COMMIT;
3 changes: 2 additions & 1 deletion schema/sqitch.plan
@@ -1,4 +1,4 @@
%syntax-version=1.2.4
%syntax-version=1.2.5
%project=schemaverse

role-players 2013-12-02T11:07:51Z Joshua McDougall <jmcdougall@bitcoinsultants.com> # Creates the players role, granted to all player accounts
Expand Down Expand Up @@ -89,3 +89,4 @@ table-round_stats 2013-12-01T18:33:48Z Joshua McDougall <jmcdougall@bitcoinsulta
function-round_control 2013-12-01T18:35:25Z Joshua McDougall <jmcdougall@bitcoinsultants.com> # Handles the round completion and new game setup
indexes 2013-12-01T18:37:52Z Joshua McDougall <jmcdougall@bitcoinsultants.com> # Lazily applies all the indexes
permissions 2013-12-01T18:38:22Z Joshua McDougall <jmcdougall@bitcoinsultants.com> # Lazily applies all the schema permissions
function-get_player_symbol 2016-12-09T16:11:08Z Matt Robinson <brimstone@the.narro.ws> # Returns the symbol associated with a player

0 comments on commit a98c436

Please sign in to comment.