 
 DROP TABLE IF EXISTS "api"."channel";
 CREATE TABLE "api"."channel" (
-    "id" bigint NOT NULL DEFAULT api.channel_next_id(),
-    "name" varchar(200) NOT NULL COLLATE "default",
-    "creator_id" bigint NOT NULL,
-    "group_name" varchar(200) NOT NULL COLLATE "default",
-    "purpose" text COLLATE "default",
-    "secret_key" text COLLATE "default",
+    "id" BIGINT NOT NULL DEFAULT api.channel_next_id (),
+    "name" VARCHAR (200) NOT NULL COLLATE "default",
+    "creator_id" BIGINT NOT NULL,
+    "group_name" VARCHAR (200) NOT NULL COLLATE "default",
+    "purpose" TEXT COLLATE "default",
+    "secret_key" TEXT COLLATE "default",
     "type_constant" "api"."channel_type_constant_enum",
     "privacy_constant" "api"."channel_privacy_constant_enum",
-    "created_at" timestamp(6) WITH TIME ZONE NOT NULL DEFAULT now(),
-    "updated_at" timestamp(6) WITH TIME ZONE NOT NULL DEFAULT now(),
-    "deleted_at" timestamp(6) WITH TIME ZONE
-)
-WITH (OIDS=FALSE);
+    "created_at" TIMESTAMP (6) WITH TIME ZONE NOT NULL DEFAULT now(),
+    "updated_at" TIMESTAMP (6) WITH TIME ZONE NOT NULL DEFAULT now(),
+    "deleted_at" TIMESTAMP (6) WITH TIME ZONE
+) WITH (OIDS = FALSE);
+
 -- ALTER TABLE "api"."channel" OWNER TO "socialapplication";
 GRANT SELECT, INSERT, UPDATE ON "api"."channel" TO "socialapplication";
 

-- ----------------------------
DROP TABLE IF EXISTS "api"."account";
CREATE TABLE "api"."account" (
    "id" bigint NOT NULL DEFAULT nextval('api.account_id_seq'::regclass),
    "old_id" varchar(24) NOT NULL COLLATE "default",
    "is_troll" boolean NOT NULL DEFAULT false,
    "nick" varchar(25) NOT NULL CHECK ("nick" <> '')
)
WITH (OIDS=FALSE);
-- ALTER TABLE "api"."account" OWNER TO "socialapplication";
GRANT SELECT, INSERT ON "api"."account" TO "socialapplication";


    'left',
    'requestpending'
);

ALTER TYPE "api"."channel_participant_status_constant_enum" OWNER TO "social";

DROP TABLE IF EXISTS "api"."channel_participant";
CREATE TABLE "api"."channel_participant" (
    "id" BIGINT NOT NULL DEFAULT nextval(
        'api.channel_participant_id_seq' :: regclass
    ),
    "channel_id" BIGINT NOT NULL DEFAULT 0,
    "account_id" BIGINT NOT NULL DEFAULT 0,
    "status_constant" "api"."channel_participant_status_constant_enum",
    "meta_bits" SMALLINT NOT NULL DEFAULT 0 :: SMALLINT,
    "last_seen_at" TIMESTAMP (6) WITH TIME ZONE NOT NULL DEFAULT now(),
    "created_at" TIMESTAMP (6) WITH TIME ZONE NOT NULL DEFAULT now(),
    "updated_at" TIMESTAMP (6) WITH TIME ZONE NOT NULL DEFAULT now()
) WITH (OIDS = FALSE);

-- ALTER TABLE "api"."channel_participant" OWNER TO "socialapplication";
GRANT SELECT, INSERT, UPDATE ON "api"."channel_participant" TO "socialapplication";

