docs(skills): 添加 Better Auth 最佳实践与安全配置指南
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
ALTER TABLE "account" ALTER COLUMN "access_token_expires_at" SET DATA TYPE timestamp with time zone USING "access_token_expires_at"::timestamp with time zone;--> statement-breakpoint
|
||||
ALTER TABLE "account" ALTER COLUMN "refresh_token_expires_at" SET DATA TYPE timestamp with time zone USING "refresh_token_expires_at"::timestamp with time zone;--> statement-breakpoint
|
||||
ALTER TABLE "account" ALTER COLUMN "created_at" SET DATA TYPE timestamp with time zone USING "created_at"::timestamp with time zone;--> statement-breakpoint
|
||||
ALTER TABLE "account" ALTER COLUMN "updated_at" SET DATA TYPE timestamp with time zone USING "updated_at"::timestamp with time zone;--> statement-breakpoint
|
||||
ALTER TABLE "session" ALTER COLUMN "expires_at" SET DATA TYPE timestamp with time zone USING "expires_at"::timestamp with time zone;--> statement-breakpoint
|
||||
ALTER TABLE "session" ALTER COLUMN "created_at" SET DATA TYPE timestamp with time zone USING "created_at"::timestamp with time zone;--> statement-breakpoint
|
||||
ALTER TABLE "session" ALTER COLUMN "updated_at" SET DATA TYPE timestamp with time zone USING "updated_at"::timestamp with time zone;--> statement-breakpoint
|
||||
ALTER TABLE "user" ALTER COLUMN "created_at" SET DATA TYPE timestamp with time zone USING "created_at"::timestamp with time zone;--> statement-breakpoint
|
||||
ALTER TABLE "user" ALTER COLUMN "updated_at" SET DATA TYPE timestamp with time zone USING "updated_at"::timestamp with time zone;--> statement-breakpoint
|
||||
ALTER TABLE "verification" ALTER COLUMN "expires_at" SET DATA TYPE timestamp with time zone USING "expires_at"::timestamp with time zone;--> statement-breakpoint
|
||||
ALTER TABLE "verification" ALTER COLUMN "created_at" SET DATA TYPE timestamp with time zone USING "created_at"::timestamp with time zone;--> statement-breakpoint
|
||||
ALTER TABLE "verification" ALTER COLUMN "updated_at" SET DATA TYPE timestamp with time zone USING "updated_at"::timestamp with time zone;
|
||||
@@ -0,0 +1,661 @@
|
||||
{
|
||||
"version": "8",
|
||||
"dialect": "postgres",
|
||||
"id": "56dfe996-2f67-4ad1-adf6-9ebccb899ecc",
|
||||
"prevIds": [
|
||||
"6fa3021b-437d-4b43-ab3d-4f7704682cd0"
|
||||
],
|
||||
"ddl": [
|
||||
{
|
||||
"isRlsEnabled": false,
|
||||
"name": "account",
|
||||
"entityType": "tables",
|
||||
"schema": "public"
|
||||
},
|
||||
{
|
||||
"isRlsEnabled": false,
|
||||
"name": "session",
|
||||
"entityType": "tables",
|
||||
"schema": "public"
|
||||
},
|
||||
{
|
||||
"isRlsEnabled": false,
|
||||
"name": "user",
|
||||
"entityType": "tables",
|
||||
"schema": "public"
|
||||
},
|
||||
{
|
||||
"isRlsEnabled": false,
|
||||
"name": "users",
|
||||
"entityType": "tables",
|
||||
"schema": "public"
|
||||
},
|
||||
{
|
||||
"isRlsEnabled": false,
|
||||
"name": "verification",
|
||||
"entityType": "tables",
|
||||
"schema": "public"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"typeSchema": null,
|
||||
"notNull": true,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"name": "id",
|
||||
"entityType": "columns",
|
||||
"schema": "public",
|
||||
"table": "account"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"typeSchema": null,
|
||||
"notNull": true,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"name": "account_id",
|
||||
"entityType": "columns",
|
||||
"schema": "public",
|
||||
"table": "account"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"typeSchema": null,
|
||||
"notNull": true,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"name": "provider_id",
|
||||
"entityType": "columns",
|
||||
"schema": "public",
|
||||
"table": "account"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"typeSchema": null,
|
||||
"notNull": true,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"name": "user_id",
|
||||
"entityType": "columns",
|
||||
"schema": "public",
|
||||
"table": "account"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"typeSchema": null,
|
||||
"notNull": false,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"name": "access_token",
|
||||
"entityType": "columns",
|
||||
"schema": "public",
|
||||
"table": "account"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"typeSchema": null,
|
||||
"notNull": false,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"name": "refresh_token",
|
||||
"entityType": "columns",
|
||||
"schema": "public",
|
||||
"table": "account"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"typeSchema": null,
|
||||
"notNull": false,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"name": "id_token",
|
||||
"entityType": "columns",
|
||||
"schema": "public",
|
||||
"table": "account"
|
||||
},
|
||||
{
|
||||
"type": "timestamp with time zone",
|
||||
"typeSchema": null,
|
||||
"notNull": false,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"name": "access_token_expires_at",
|
||||
"entityType": "columns",
|
||||
"schema": "public",
|
||||
"table": "account"
|
||||
},
|
||||
{
|
||||
"type": "timestamp with time zone",
|
||||
"typeSchema": null,
|
||||
"notNull": false,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"name": "refresh_token_expires_at",
|
||||
"entityType": "columns",
|
||||
"schema": "public",
|
||||
"table": "account"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"typeSchema": null,
|
||||
"notNull": false,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"name": "scope",
|
||||
"entityType": "columns",
|
||||
"schema": "public",
|
||||
"table": "account"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"typeSchema": null,
|
||||
"notNull": false,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"name": "password",
|
||||
"entityType": "columns",
|
||||
"schema": "public",
|
||||
"table": "account"
|
||||
},
|
||||
{
|
||||
"type": "timestamp with time zone",
|
||||
"typeSchema": null,
|
||||
"notNull": true,
|
||||
"dimensions": 0,
|
||||
"default": "now()",
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"name": "created_at",
|
||||
"entityType": "columns",
|
||||
"schema": "public",
|
||||
"table": "account"
|
||||
},
|
||||
{
|
||||
"type": "timestamp with time zone",
|
||||
"typeSchema": null,
|
||||
"notNull": true,
|
||||
"dimensions": 0,
|
||||
"default": "now()",
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"name": "updated_at",
|
||||
"entityType": "columns",
|
||||
"schema": "public",
|
||||
"table": "account"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"typeSchema": null,
|
||||
"notNull": true,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"name": "id",
|
||||
"entityType": "columns",
|
||||
"schema": "public",
|
||||
"table": "session"
|
||||
},
|
||||
{
|
||||
"type": "timestamp with time zone",
|
||||
"typeSchema": null,
|
||||
"notNull": true,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"name": "expires_at",
|
||||
"entityType": "columns",
|
||||
"schema": "public",
|
||||
"table": "session"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"typeSchema": null,
|
||||
"notNull": true,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"name": "token",
|
||||
"entityType": "columns",
|
||||
"schema": "public",
|
||||
"table": "session"
|
||||
},
|
||||
{
|
||||
"type": "timestamp with time zone",
|
||||
"typeSchema": null,
|
||||
"notNull": true,
|
||||
"dimensions": 0,
|
||||
"default": "now()",
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"name": "created_at",
|
||||
"entityType": "columns",
|
||||
"schema": "public",
|
||||
"table": "session"
|
||||
},
|
||||
{
|
||||
"type": "timestamp with time zone",
|
||||
"typeSchema": null,
|
||||
"notNull": true,
|
||||
"dimensions": 0,
|
||||
"default": "now()",
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"name": "updated_at",
|
||||
"entityType": "columns",
|
||||
"schema": "public",
|
||||
"table": "session"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"typeSchema": null,
|
||||
"notNull": false,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"name": "ip_address",
|
||||
"entityType": "columns",
|
||||
"schema": "public",
|
||||
"table": "session"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"typeSchema": null,
|
||||
"notNull": false,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"name": "user_agent",
|
||||
"entityType": "columns",
|
||||
"schema": "public",
|
||||
"table": "session"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"typeSchema": null,
|
||||
"notNull": true,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"name": "user_id",
|
||||
"entityType": "columns",
|
||||
"schema": "public",
|
||||
"table": "session"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"typeSchema": null,
|
||||
"notNull": true,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"name": "id",
|
||||
"entityType": "columns",
|
||||
"schema": "public",
|
||||
"table": "user"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"typeSchema": null,
|
||||
"notNull": true,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"name": "name",
|
||||
"entityType": "columns",
|
||||
"schema": "public",
|
||||
"table": "user"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"typeSchema": null,
|
||||
"notNull": true,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"name": "email",
|
||||
"entityType": "columns",
|
||||
"schema": "public",
|
||||
"table": "user"
|
||||
},
|
||||
{
|
||||
"type": "boolean",
|
||||
"typeSchema": null,
|
||||
"notNull": true,
|
||||
"dimensions": 0,
|
||||
"default": "false",
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"name": "email_verified",
|
||||
"entityType": "columns",
|
||||
"schema": "public",
|
||||
"table": "user"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"typeSchema": null,
|
||||
"notNull": false,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"name": "image",
|
||||
"entityType": "columns",
|
||||
"schema": "public",
|
||||
"table": "user"
|
||||
},
|
||||
{
|
||||
"type": "timestamp with time zone",
|
||||
"typeSchema": null,
|
||||
"notNull": true,
|
||||
"dimensions": 0,
|
||||
"default": "now()",
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"name": "created_at",
|
||||
"entityType": "columns",
|
||||
"schema": "public",
|
||||
"table": "user"
|
||||
},
|
||||
{
|
||||
"type": "timestamp with time zone",
|
||||
"typeSchema": null,
|
||||
"notNull": true,
|
||||
"dimensions": 0,
|
||||
"default": "now()",
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"name": "updated_at",
|
||||
"entityType": "columns",
|
||||
"schema": "public",
|
||||
"table": "user"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"typeSchema": null,
|
||||
"notNull": true,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": {
|
||||
"type": "always",
|
||||
"name": "users_id_seq",
|
||||
"increment": "1",
|
||||
"startWith": "1",
|
||||
"minValue": "1",
|
||||
"maxValue": "2147483647",
|
||||
"cache": 1,
|
||||
"cycle": false
|
||||
},
|
||||
"name": "id",
|
||||
"entityType": "columns",
|
||||
"schema": "public",
|
||||
"table": "users"
|
||||
},
|
||||
{
|
||||
"type": "varchar(255)",
|
||||
"typeSchema": null,
|
||||
"notNull": true,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"name": "name",
|
||||
"entityType": "columns",
|
||||
"schema": "public",
|
||||
"table": "users"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"typeSchema": null,
|
||||
"notNull": true,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"name": "age",
|
||||
"entityType": "columns",
|
||||
"schema": "public",
|
||||
"table": "users"
|
||||
},
|
||||
{
|
||||
"type": "varchar(255)",
|
||||
"typeSchema": null,
|
||||
"notNull": true,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"name": "email",
|
||||
"entityType": "columns",
|
||||
"schema": "public",
|
||||
"table": "users"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"typeSchema": null,
|
||||
"notNull": true,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"name": "id",
|
||||
"entityType": "columns",
|
||||
"schema": "public",
|
||||
"table": "verification"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"typeSchema": null,
|
||||
"notNull": true,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"name": "identifier",
|
||||
"entityType": "columns",
|
||||
"schema": "public",
|
||||
"table": "verification"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"typeSchema": null,
|
||||
"notNull": true,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"name": "value",
|
||||
"entityType": "columns",
|
||||
"schema": "public",
|
||||
"table": "verification"
|
||||
},
|
||||
{
|
||||
"type": "timestamp with time zone",
|
||||
"typeSchema": null,
|
||||
"notNull": true,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"name": "expires_at",
|
||||
"entityType": "columns",
|
||||
"schema": "public",
|
||||
"table": "verification"
|
||||
},
|
||||
{
|
||||
"type": "timestamp with time zone",
|
||||
"typeSchema": null,
|
||||
"notNull": false,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"name": "created_at",
|
||||
"entityType": "columns",
|
||||
"schema": "public",
|
||||
"table": "verification"
|
||||
},
|
||||
{
|
||||
"type": "timestamp with time zone",
|
||||
"typeSchema": null,
|
||||
"notNull": false,
|
||||
"dimensions": 0,
|
||||
"default": null,
|
||||
"generated": null,
|
||||
"identity": null,
|
||||
"name": "updated_at",
|
||||
"entityType": "columns",
|
||||
"schema": "public",
|
||||
"table": "verification"
|
||||
},
|
||||
{
|
||||
"nameExplicit": false,
|
||||
"columns": [
|
||||
"user_id"
|
||||
],
|
||||
"schemaTo": "public",
|
||||
"tableTo": "user",
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"onUpdate": "NO ACTION",
|
||||
"onDelete": "CASCADE",
|
||||
"name": "account_user_id_user_id_fkey",
|
||||
"entityType": "fks",
|
||||
"schema": "public",
|
||||
"table": "account"
|
||||
},
|
||||
{
|
||||
"nameExplicit": false,
|
||||
"columns": [
|
||||
"user_id"
|
||||
],
|
||||
"schemaTo": "public",
|
||||
"tableTo": "user",
|
||||
"columnsTo": [
|
||||
"id"
|
||||
],
|
||||
"onUpdate": "NO ACTION",
|
||||
"onDelete": "CASCADE",
|
||||
"name": "session_user_id_user_id_fkey",
|
||||
"entityType": "fks",
|
||||
"schema": "public",
|
||||
"table": "session"
|
||||
},
|
||||
{
|
||||
"columns": [
|
||||
"id"
|
||||
],
|
||||
"nameExplicit": false,
|
||||
"name": "account_pkey",
|
||||
"schema": "public",
|
||||
"table": "account",
|
||||
"entityType": "pks"
|
||||
},
|
||||
{
|
||||
"columns": [
|
||||
"id"
|
||||
],
|
||||
"nameExplicit": false,
|
||||
"name": "session_pkey",
|
||||
"schema": "public",
|
||||
"table": "session",
|
||||
"entityType": "pks"
|
||||
},
|
||||
{
|
||||
"columns": [
|
||||
"id"
|
||||
],
|
||||
"nameExplicit": false,
|
||||
"name": "user_pkey",
|
||||
"schema": "public",
|
||||
"table": "user",
|
||||
"entityType": "pks"
|
||||
},
|
||||
{
|
||||
"columns": [
|
||||
"id"
|
||||
],
|
||||
"nameExplicit": false,
|
||||
"name": "users_pkey",
|
||||
"schema": "public",
|
||||
"table": "users",
|
||||
"entityType": "pks"
|
||||
},
|
||||
{
|
||||
"columns": [
|
||||
"id"
|
||||
],
|
||||
"nameExplicit": false,
|
||||
"name": "verification_pkey",
|
||||
"schema": "public",
|
||||
"table": "verification",
|
||||
"entityType": "pks"
|
||||
},
|
||||
{
|
||||
"nameExplicit": false,
|
||||
"columns": [
|
||||
"token"
|
||||
],
|
||||
"nullsNotDistinct": false,
|
||||
"name": "session_token_key",
|
||||
"schema": "public",
|
||||
"table": "session",
|
||||
"entityType": "uniques"
|
||||
},
|
||||
{
|
||||
"nameExplicit": false,
|
||||
"columns": [
|
||||
"email"
|
||||
],
|
||||
"nullsNotDistinct": false,
|
||||
"name": "user_email_key",
|
||||
"schema": "public",
|
||||
"table": "user",
|
||||
"entityType": "uniques"
|
||||
},
|
||||
{
|
||||
"nameExplicit": false,
|
||||
"columns": [
|
||||
"email"
|
||||
],
|
||||
"nullsNotDistinct": false,
|
||||
"name": "users_email_key",
|
||||
"schema": "public",
|
||||
"table": "users",
|
||||
"entityType": "uniques"
|
||||
}
|
||||
],
|
||||
"renames": []
|
||||
}
|
||||
Reference in New Issue
Block a user