0.4.0b1 add database and /userinfo (incomplete)
This commit is contained in:
parent
3f13fe1ec0
commit
5b98a2e98a
18 changed files with 1194 additions and 243 deletions
26
drizzle/0000_strange_fabian_cortez.sql
Normal file
26
drizzle/0000_strange_fabian_cortez.sql
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
CREATE TABLE "balances" (
|
||||
"userId" integer,
|
||||
"guildId" integer,
|
||||
"balance" bigint DEFAULT 0::bigint,
|
||||
"lastMessageHour" integer,
|
||||
CONSTRAINT "balances_userId_guildId_pk" PRIMARY KEY("userId","guildId")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "guilds" (
|
||||
"id" serial PRIMARY KEY NOT NULL,
|
||||
"discordId" bigint,
|
||||
"displayName" varchar(80),
|
||||
CONSTRAINT "guilds_discordId_unique" UNIQUE("discordId")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "users" (
|
||||
"id" serial PRIMARY KEY NOT NULL,
|
||||
"discordId" bigint,
|
||||
"username" varchar(34),
|
||||
"displayName" varchar(64),
|
||||
"reputation" smallint DEFAULT 0,
|
||||
CONSTRAINT "users_discordId_unique" UNIQUE("discordId")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "balances" ADD CONSTRAINT "balances_userId_users_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "balances" ADD CONSTRAINT "balances_guildId_guilds_id_fk" FOREIGN KEY ("guildId") REFERENCES "public"."guilds"("id") ON DELETE no action ON UPDATE no action;
|
||||
Loading…
Add table
Add a link
Reference in a new issue