Skip to content

Commit

Permalink
BugFix: Create extension in superuser and cast char to text (#751)
Browse files Browse the repository at this point in the history
  • Loading branch information
rmeena840 authored Jul 28, 2022
1 parent 0fe3df9 commit e7b67d2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 3 additions & 0 deletions examples/dao/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,7 @@ drop-sigma-dao-user:

# execute sigma dao setup file. Indexer should be running before executing this script
setup-sigma-dao:
# pg_trgm extension.
@psql -d $(POSTGRES_DBNAME) -c "CREATE EXTENSION IF NOT EXISTS pg_trgm;"
# execute file
@psql -U $(POSTGRES_UNAME) -d $(POSTGRES_DBNAME) -a -f $(SIGMA_DAO_SETUP_FILE)
4 changes: 1 addition & 3 deletions examples/dao/setup_sigma_dao.sql
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ CREATE TABLE IF NOT EXISTS sigma_dao_proposals (
-- Create indexes
CREATE UNIQUE INDEX sigma_daos_app_id_idx ON sigma_daos (app_id);
-- create an index to do efficient text search using `%<text>%`, it requires
-- pg_trgm extension.
CREATE EXTENSION pg_trgm;
CREATE INDEX sigma_daos_dao_name_idx ON sigma_daos USING gin (dao_name gin_trgm_ops);
CREATE INDEX sigma_daos_dao_name_idx ON sigma_daos USING gin (CAST(dao_name AS TEXT) gin_trgm_ops);

-- create a procedure to handle the trigger (sigmadao_trigger_fn) action
CREATE OR REPLACE FUNCTION sigmadao_trigger_fn()
Expand Down

0 comments on commit e7b67d2

Please sign in to comment.