Files
lobehub/packages/database/migrations/0065_add_passkey.sql
Rdmclin2 8c42a934b3 feat: mobile native better auth support (#10871)
* feat: mobile native better auth support

* chore: add android assetlinks

* chore: add android assetlinks

* chore: add expo fingerpoint

* chore: add relation

* chore: add android origin hash

* chore: update passkey table

* chore: optimize version

* chore: remove as any

* fix: sql not exits problem

* fix: passkey statement

* fix:  passkey origin null

* chore: remove strict peer dependencies

* fix: test case

* chore: remove local passkey origin
2025-12-23 15:19:42 +08:00

22 lines
867 B
SQL

CREATE TABLE IF NOT EXISTS "passkey" (
"aaguid" text,
"backedUp" boolean,
"counter" integer,
"createdAt" timestamp DEFAULT now(),
"credentialID" text NOT NULL,
"deviceType" text,
"id" text PRIMARY KEY NOT NULL,
"name" text,
"publicKey" text NOT NULL,
"transports" text,
"userId" text NOT NULL
);
--> statement-breakpoint
DO $$ BEGIN
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'passkey_userId_users_id_fk') THEN
ALTER TABLE "passkey" ADD CONSTRAINT "passkey_userId_users_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
END IF;
END $$;
--> statement-breakpoint
CREATE UNIQUE INDEX IF NOT EXISTS "passkey_credential_id_unique" ON "passkey" USING btree ("credentialID");--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "passkey_user_id_idx" ON "passkey" USING btree ("userId");