common/dal/schema/000018_init.up.sql

16 lines
506 B
SQL

DO $$
BEGIN
IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'tgAccountStatus') THEN
CREATE TYPE TgAccountStatus AS ENUM ('active', 'inactive', 'ban');
END IF;
END $$;
CREATE TABLE IF NOT EXISTS tgAccounts (
id bigserial primary key ,
ApiID integer not null,
ApiHash text not null ,
PhoneNumber text not null ,
Status TgAccountStatus not null,
Deleted bool not null default false,
CreatedAt timestamp not null default current_timestamp
)