u
This commit is contained in:
1 parent
19b160620f
commit
835958886e
47 files changed
+9573
No files matched your search
@@ -0,0 +1,124 @@
|
||||
CREATE TABLE "finance_category_default" (
|
||||
"id" bigint PRIMARY KEY NOT NULL,
|
||||
"name" varchar(64) NOT NULL,
|
||||
"icon" varchar(64) NOT NULL,
|
||||
"type" smallint DEFAULT 0 NOT NULL,
|
||||
"sort_number" integer DEFAULT 0 NOT NULL,
|
||||
"create_time" timestamp with time zone DEFAULT now(),
|
||||
"update_time" timestamp with time zone DEFAULT now()
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "finance_category_space" (
|
||||
"id" bigint PRIMARY KEY NOT NULL,
|
||||
"space_id" bigint NOT NULL,
|
||||
"name" varchar(64) NOT NULL,
|
||||
"icon" varchar(64) NOT NULL,
|
||||
"type" smallint DEFAULT 0 NOT NULL,
|
||||
"sort_number" integer DEFAULT 0 NOT NULL,
|
||||
"create_by" bigint NOT NULL,
|
||||
"create_time" timestamp with time zone DEFAULT now(),
|
||||
"update_by" bigint NOT NULL,
|
||||
"update_time" timestamp with time zone DEFAULT now()
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "finance_record" (
|
||||
"id" bigint PRIMARY KEY NOT NULL,
|
||||
"category_id" bigint NOT NULL,
|
||||
"space_id" bigint NOT NULL,
|
||||
"amount" numeric(12, 2) NOT NULL,
|
||||
"remark" varchar(255),
|
||||
"record_time" date,
|
||||
"create_by" bigint NOT NULL,
|
||||
"create_time" timestamp with time zone DEFAULT now(),
|
||||
"update_by" bigint NOT NULL,
|
||||
"update_time" timestamp with time zone DEFAULT now()
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "session" (
|
||||
"id" bigint PRIMARY KEY NOT NULL,
|
||||
"space_id" bigint NOT NULL,
|
||||
"type" smallint DEFAULT 0 NOT NULL,
|
||||
"name" varchar(64),
|
||||
"avatar" varchar(255),
|
||||
"description" text,
|
||||
"status" smallint DEFAULT 0 NOT NULL,
|
||||
"create_time" timestamp with time zone DEFAULT now(),
|
||||
"update_time" timestamp with time zone DEFAULT now()
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "session_member" (
|
||||
"id" bigint PRIMARY KEY NOT NULL,
|
||||
"session_id" bigint NOT NULL,
|
||||
"user_id" bigint NOT NULL,
|
||||
"remark" varchar(255),
|
||||
"is_top" smallint DEFAULT 0 NOT NULL,
|
||||
"unread_count" integer DEFAULT 0,
|
||||
"last_msg_id" bigint,
|
||||
"status" integer DEFAULT 0,
|
||||
"create_time" timestamp with time zone DEFAULT now(),
|
||||
"update_time" timestamp with time zone DEFAULT now()
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "session_message" (
|
||||
"id" bigint PRIMARY KEY NOT NULL,
|
||||
"session_id" bigint NOT NULL,
|
||||
"sender_id" bigint NOT NULL,
|
||||
"content" text NOT NULL,
|
||||
"content_type" smallint DEFAULT 0 NOT NULL,
|
||||
"create_time" timestamp with time zone DEFAULT now()
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "space" (
|
||||
"id" bigint PRIMARY KEY NOT NULL,
|
||||
"name" varchar(255) NOT NULL,
|
||||
"invite_code" varchar(30) NOT NULL,
|
||||
"owner_id" bigint NOT NULL,
|
||||
"create_time" timestamp with time zone DEFAULT now(),
|
||||
"update_time" timestamp with time zone DEFAULT now()
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "space_member" (
|
||||
"id" bigint PRIMARY KEY NOT NULL,
|
||||
"space_id" bigint NOT NULL,
|
||||
"user_id" bigint NOT NULL,
|
||||
"role" smallint DEFAULT 2 NOT NULL,
|
||||
"join_time" timestamp with time zone DEFAULT now(),
|
||||
"update_time" timestamp with time zone DEFAULT now()
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "user" (
|
||||
"id" bigint PRIMARY KEY NOT NULL,
|
||||
"nickname" varchar(255),
|
||||
"avatar" varchar(255),
|
||||
"status" smallint DEFAULT 0 NOT NULL,
|
||||
"last_login_time" timestamp with time zone,
|
||||
"create_time" timestamp with time zone DEFAULT now(),
|
||||
"update_time" timestamp with time zone DEFAULT now()
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "user_oauth" (
|
||||
"id" bigint PRIMARY KEY NOT NULL,
|
||||
"user_id" bigint NOT NULL,
|
||||
"type" smallint DEFAULT 0 NOT NULL,
|
||||
"openid" varchar(255) NOT NULL,
|
||||
"create_time" timestamp with time zone DEFAULT now(),
|
||||
"update_time" timestamp with time zone DEFAULT now()
|
||||
);
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "finance_category_space" ADD CONSTRAINT "finance_category_space_space_id_space_id_fk" FOREIGN KEY ("space_id") REFERENCES "public"."space"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "finance_category_space" ADD CONSTRAINT "finance_category_space_create_by_user_id_fk" FOREIGN KEY ("create_by") REFERENCES "public"."user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "finance_category_space" ADD CONSTRAINT "finance_category_space_update_by_user_id_fk" FOREIGN KEY ("update_by") REFERENCES "public"."user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "finance_record" ADD CONSTRAINT "finance_record_category_id_finance_category_space_id_fk" FOREIGN KEY ("category_id") REFERENCES "public"."finance_category_space"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "finance_record" ADD CONSTRAINT "finance_record_space_id_space_id_fk" FOREIGN KEY ("space_id") REFERENCES "public"."space"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "finance_record" ADD CONSTRAINT "finance_record_create_by_user_id_fk" FOREIGN KEY ("create_by") REFERENCES "public"."user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "finance_record" ADD CONSTRAINT "finance_record_update_by_user_id_fk" FOREIGN KEY ("update_by") REFERENCES "public"."user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "session" ADD CONSTRAINT "session_space_id_space_id_fk" FOREIGN KEY ("space_id") REFERENCES "public"."space"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "session_member" ADD CONSTRAINT "session_member_session_id_session_id_fk" FOREIGN KEY ("session_id") REFERENCES "public"."session"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "session_member" ADD CONSTRAINT "session_member_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "session_member" ADD CONSTRAINT "session_member_last_msg_id_session_message_id_fk" FOREIGN KEY ("last_msg_id") REFERENCES "public"."session_message"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "session_message" ADD CONSTRAINT "session_message_session_id_session_id_fk" FOREIGN KEY ("session_id") REFERENCES "public"."session"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "session_message" ADD CONSTRAINT "session_message_sender_id_user_id_fk" FOREIGN KEY ("sender_id") REFERENCES "public"."user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "space" ADD CONSTRAINT "space_owner_id_user_id_fk" FOREIGN KEY ("owner_id") REFERENCES "public"."user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "space_member" ADD CONSTRAINT "space_member_space_id_space_id_fk" FOREIGN KEY ("space_id") REFERENCES "public"."space"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "space_member" ADD CONSTRAINT "space_member_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "user_oauth" ADD CONSTRAINT "user_oauth_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE no action ON UPDATE no action;
|
||||
Reference in new issue
Block a user