github.com/DapperCollectives/CAST/backend@v0.0.0-20230921221157-1350c8be7c96/migrations/000036_drop_user_achievements_table.down.sql (about)

     1  ALTER TABLE votes DROP COLUMN IF EXISTS is_early;
     2  ALTER TABLE votes DROP COLUMN IF EXISTS is_winning;
     3  
     4  CREATE TYPE achievement_types AS enum ('earlyVote', 'streak', 'winningVote');
     5  
     6  CREATE EXTENSION IF NOT EXISTS tablefunc;
     7  
     8  CREATE TABLE user_achievements (
     9    id BIGSERIAL primary key,
    10    addr VARCHAR(18) NOT NULL,
    11    achievement_type achievement_types,
    12    community_id INT not null references communities(id),
    13    proposals BIGINT array,
    14    created_at timestamp with time zone NOT NULL DEFAULT now(),
    15    updated_at timestamp with time zone NOT NULL DEFAULT now(),
    16    details VARCHAR NOT NULL
    17  );
    18  
    19  ALTER TABLE user_achievements ADD UNIQUE (details);
    20  
    21  ALTER TABLE proposals DROP COLUMN IF EXISTS achievements_done;
    22