CREATE EXTENSION IF NOT EXISTS pgcrypto; CREATE TABLE users ( id uuid PRIMARY KEY DEFAULT gen_random_uuid(), twitter_id CHARACTER VARYING(256) NOT NULL, username CHARACTER VARYING(255) NOT NULL, name CHARACTER VARYING(255) NOT NULL, access_token CHARACTER VARYING(512) NOT NULL, refresh_token CHARACTER VARYING(512) NOT NULL, delete_tweets_enabled boolean NOT NULL DEFAULT false, delete_tweets_num_per_iteration int NOT NULL DEFAULT 1, created_at TIMESTAMP WITH TIME ZONE NOT NULL, updated_at TIMESTAMP WITH TIME ZONE NOT NULL ); CREATE UNIQUE INDEX index_users_on_twitter_id ON users (twitter_id);