81 lines
2.4 KiB
MySQL
81 lines
2.4 KiB
MySQL
|
|
BEGIN;
|
||
|
|
|
||
|
|
--
|
||
|
|
-- ACTION CREATE TABLE
|
||
|
|
--
|
||
|
|
CREATE TABLE "assistant_figures" (
|
||
|
|
"id" bigserial PRIMARY KEY,
|
||
|
|
"authUserId" uuid NOT NULL,
|
||
|
|
"assistant" text NOT NULL,
|
||
|
|
"day" timestamp without time zone NOT NULL,
|
||
|
|
"requests" bigint NOT NULL,
|
||
|
|
"inputTokens" bigint NOT NULL,
|
||
|
|
"outputTokens" bigint NOT NULL,
|
||
|
|
"costMicros" bigint NOT NULL
|
||
|
|
);
|
||
|
|
|
||
|
|
-- Indexes
|
||
|
|
CREATE UNIQUE INDEX "assistant_figures_day_idx" ON "assistant_figures" USING btree ("authUserId", "assistant", "day");
|
||
|
|
CREATE INDEX "assistant_figures_age_idx" ON "assistant_figures" USING btree ("day");
|
||
|
|
|
||
|
|
--
|
||
|
|
-- ACTION CREATE TABLE
|
||
|
|
--
|
||
|
|
CREATE TABLE "assistant_grant" (
|
||
|
|
"id" bigserial PRIMARY KEY,
|
||
|
|
"authUserId" uuid NOT NULL,
|
||
|
|
"assistant" text NOT NULL,
|
||
|
|
"grantedAt" timestamp without time zone NOT NULL,
|
||
|
|
"limitUnit" text NOT NULL,
|
||
|
|
"dailyLimit" bigint,
|
||
|
|
"monthlyLimit" bigint,
|
||
|
|
"agreedAt" timestamp without time zone,
|
||
|
|
"agreedTo" text
|
||
|
|
);
|
||
|
|
|
||
|
|
-- Indexes
|
||
|
|
CREATE UNIQUE INDEX "assistant_grant_person_idx" ON "assistant_grant" USING btree ("authUserId", "assistant");
|
||
|
|
|
||
|
|
|
||
|
|
--
|
||
|
|
-- MIGRATION VERSION FOR halkyon_base
|
||
|
|
--
|
||
|
|
INSERT INTO "serverpod_migrations" ("module", "version", "timestamp")
|
||
|
|
VALUES ('halkyon_base', '20261025165102522-assistants', now())
|
||
|
|
ON CONFLICT ("module")
|
||
|
|
DO UPDATE SET "version" = '20261025165102522-assistants', "timestamp" = now();
|
||
|
|
|
||
|
|
--
|
||
|
|
-- MIGRATION VERSION FOR halkyon_oidc
|
||
|
|
--
|
||
|
|
INSERT INTO "serverpod_migrations" ("module", "version", "timestamp")
|
||
|
|
VALUES ('halkyon_oidc', '20261023180644988', now())
|
||
|
|
ON CONFLICT ("module")
|
||
|
|
DO UPDATE SET "version" = '20261023180644988', "timestamp" = now();
|
||
|
|
|
||
|
|
--
|
||
|
|
-- MIGRATION VERSION FOR serverpod
|
||
|
|
--
|
||
|
|
INSERT INTO "serverpod_migrations" ("module", "version", "timestamp")
|
||
|
|
VALUES ('serverpod', '20260824182259319', now())
|
||
|
|
ON CONFLICT ("module")
|
||
|
|
DO UPDATE SET "version" = '20260824182259319', "timestamp" = now();
|
||
|
|
|
||
|
|
--
|
||
|
|
-- MIGRATION VERSION FOR serverpod_auth_idp
|
||
|
|
--
|
||
|
|
INSERT INTO "serverpod_migrations" ("module", "version", "timestamp")
|
||
|
|
VALUES ('serverpod_auth_idp', '20260924105404509', now())
|
||
|
|
ON CONFLICT ("module")
|
||
|
|
DO UPDATE SET "version" = '20260924105404509', "timestamp" = now();
|
||
|
|
|
||
|
|
--
|
||
|
|
-- MIGRATION VERSION FOR serverpod_auth_core
|
||
|
|
--
|
||
|
|
INSERT INTO "serverpod_migrations" ("module", "version", "timestamp")
|
||
|
|
VALUES ('serverpod_auth_core', '20260924105232991', now())
|
||
|
|
ON CONFLICT ("module")
|
||
|
|
DO UPDATE SET "version" = '20260924105232991', "timestamp" = now();
|
||
|
|
|
||
|
|
|
||
|
|
COMMIT;
|