Browse Source

feat(discover): default discoverVisible to on for new users

- Schema + migration 0007 rebuild users table with discover_visible DEFAULT true
- Profile form initial state matches (checkbox pre-checked before load)
- Journal when for 0007 set after 0006 so drizzle-kit migrate applies it
- Spec: document default opt-in

Made-with: Cursor
main
npmrun 5 hours ago
parent
commit
24b358115d
  1. 2
      app/pages/me/profile/index.vue
  2. 2
      docs/superpowers/specs/2026-04-18-discover-page-design.md
  3. 2
      packages/drizzle-pkg/database/sqlite/schema/auth.ts
  4. 28
      packages/drizzle-pkg/migrations/0007_vengeful_puck.sql
  5. 1153
      packages/drizzle-pkg/migrations/meta/0007_snapshot.json
  6. 7
      packages/drizzle-pkg/migrations/meta/_journal.json

2
app/pages/me/profile/index.vue

@ -33,7 +33,7 @@ const state = reactive({
bioMarkdown: '', bioMarkdown: '',
bioVisibility: 'private', bioVisibility: 'private',
publicSlug: '', publicSlug: '',
discoverVisible: false, discoverVisible: true,
discoverLocation: '', discoverLocation: '',
discoverShowLocation: false, discoverShowLocation: false,
linksJson: '[]', linksJson: '[]',

2
docs/superpowers/specs/2026-04-18-discover-page-design.md

@ -26,7 +26,7 @@
| 字段(语义) | 类型建议 | 默认值 | 说明 | | 字段(语义) | 类型建议 | 默认值 | 说明 |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| 出现在发现中 | `integer`(0/1)或等价 boolean | **0(false)** | 默认不曝光,需用户主动打开 | | 出现在发现中 | `integer`(0/1)或等价 boolean | **1(true)** | 默认出现在发现中,可在资料中关闭 |
| 发现卡片地址文案 | `text`,可空 | `NULL` | 用户自填展示用字符串(首版不做地图/结构化省市区) | | 发现卡片地址文案 | `text`,可空 | `NULL` | 用户自填展示用字符串(首版不做地图/结构化省市区) |
| 在发现卡片上显示地址 | `integer`(0/1) | **0(false)** | 仅当「出现在发现中」为真时有意义;避免无文案仍出现「地址」标签 | | 在发现卡片上显示地址 | `integer`(0/1) | **0(false)** | 仅当「出现在发现中」为真时有意义;避免无文案仍出现「地址」标签 |

2
packages/drizzle-pkg/database/sqlite/schema/auth.ts

@ -14,7 +14,7 @@ export const users = sqliteTable("users", {
bioVisibility: text("bio_visibility").notNull().default("private"), bioVisibility: text("bio_visibility").notNull().default("private"),
socialLinksJson: text("social_links_json").notNull().default("[]"), socialLinksJson: text("social_links_json").notNull().default("[]"),
avatarVisibility: text("avatar_visibility").notNull().default("private"), avatarVisibility: text("avatar_visibility").notNull().default("private"),
discoverVisible: integer("discover_visible", { mode: "boolean" }).notNull().default(false), discoverVisible: integer("discover_visible", { mode: "boolean" }).notNull().default(true),
discoverLocation: text("discover_location"), discoverLocation: text("discover_location"),
discoverShowLocation: integer("discover_show_location", { mode: "boolean" }).notNull().default(false), discoverShowLocation: integer("discover_show_location", { mode: "boolean" }).notNull().default(false),
createdAt: integer("created_at", { mode: "timestamp_ms" }).defaultNow().notNull(), createdAt: integer("created_at", { mode: "timestamp_ms" }).defaultNow().notNull(),

28
packages/drizzle-pkg/migrations/0007_vengeful_puck.sql

@ -0,0 +1,28 @@
PRAGMA foreign_keys=OFF;--> statement-breakpoint
CREATE TABLE `__new_users` (
`id` integer PRIMARY KEY NOT NULL,
`username` text NOT NULL,
`email` text,
`nickname` text,
`password` text NOT NULL,
`avatar` text,
`role` text DEFAULT 'user' NOT NULL,
`status` text DEFAULT 'active' NOT NULL,
`public_slug` text,
`bio_markdown` text,
`bio_visibility` text DEFAULT 'private' NOT NULL,
`social_links_json` text DEFAULT '[]' NOT NULL,
`avatar_visibility` text DEFAULT 'private' NOT NULL,
`discover_visible` integer DEFAULT true NOT NULL,
`discover_location` text,
`discover_show_location` integer DEFAULT false NOT NULL,
`created_at` integer DEFAULT (cast((julianday('now') - 2440587.5)*86400000 as integer)) NOT NULL,
`updated_at` integer DEFAULT (cast((julianday('now') - 2440587.5)*86400000 as integer)) NOT NULL
);
--> statement-breakpoint
INSERT INTO `__new_users`("id", "username", "email", "nickname", "password", "avatar", "role", "status", "public_slug", "bio_markdown", "bio_visibility", "social_links_json", "avatar_visibility", "discover_visible", "discover_location", "discover_show_location", "created_at", "updated_at") SELECT "id", "username", "email", "nickname", "password", "avatar", "role", "status", "public_slug", "bio_markdown", "bio_visibility", "social_links_json", "avatar_visibility", "discover_visible", "discover_location", "discover_show_location", "created_at", "updated_at" FROM `users`;--> statement-breakpoint
DROP TABLE `users`;--> statement-breakpoint
ALTER TABLE `__new_users` RENAME TO `users`;--> statement-breakpoint
PRAGMA foreign_keys=ON;--> statement-breakpoint
CREATE UNIQUE INDEX `users_username_unique` ON `users` (`username`);--> statement-breakpoint
CREATE UNIQUE INDEX `users_public_slug_unique` ON `users` (`public_slug`);

1153
packages/drizzle-pkg/migrations/meta/0007_snapshot.json

File diff suppressed because it is too large

7
packages/drizzle-pkg/migrations/meta/_journal.json

@ -50,6 +50,13 @@
"when": 1776800000000, "when": 1776800000000,
"tag": "0006_left_kitty_pryde", "tag": "0006_left_kitty_pryde",
"breakpoints": true "breakpoints": true
},
{
"idx": 7,
"version": "6",
"when": 1776900000000,
"tag": "0007_vengeful_puck",
"breakpoints": true
} }
] ]
} }
Loading…
Cancel
Save