feat(web): up avatars, follower count, and dedupe views/avg secondary
This commit is contained in:
1 parent
1ed3746f4b
commit
2ff3e7952b
23 files changed
+209
-58
No files matched your search
@@ -37,8 +37,8 @@ def test_fresh_and_idempotent():
|
||||
conn = sqlite3.connect(Path(tmp) / "app.db")
|
||||
try:
|
||||
applied = run_migrations(conn)
|
||||
assert applied == [1, 2, 3, 4, 5]
|
||||
assert current_version(conn) == 5
|
||||
assert applied == [1, 2, 3, 4, 5, 6]
|
||||
assert current_version(conn) == 6
|
||||
assert EXPECTED_TABLES <= table_names(conn)
|
||||
assert "schema_version" in table_names(conn)
|
||||
columns = {
|
||||
@@ -54,7 +54,7 @@ def test_fresh_and_idempotent():
|
||||
}
|
||||
assert {
|
||||
"pages", "duration", "up_follower", "up_follower_at",
|
||||
"up_follower_backfilled",
|
||||
"up_follower_backfilled", "up_face",
|
||||
} <= video_columns
|
||||
profile_columns = {
|
||||
row[1] for row in conn.execute("PRAGMA table_info(up_profile)")
|
||||
@@ -66,7 +66,7 @@ def test_fresh_and_idempotent():
|
||||
# 再跑一次不应重复应用
|
||||
assert run_migrations(conn) == []
|
||||
row = conn.execute("SELECT COUNT(*) FROM schema_version").fetchone()
|
||||
assert row[0] == 5
|
||||
assert row[0] == 6
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
@@ -81,15 +81,15 @@ def test_backup_before_upgrade():
|
||||
conn.execute("INSERT INTO kv(k, v) VALUES ('hello', 'world')")
|
||||
conn.commit()
|
||||
|
||||
v6 = Migration(6, "add probe", ("CREATE TABLE probe (id INTEGER PRIMARY KEY)",))
|
||||
v7 = Migration(7, "add probe", ("CREATE TABLE probe (id INTEGER PRIMARY KEY)",))
|
||||
applied = run_migrations(
|
||||
conn,
|
||||
backup_dir=backup_dir,
|
||||
now=1_800_000_000,
|
||||
migrations=MIGRATIONS + (v6,),
|
||||
migrations=MIGRATIONS + (v7,),
|
||||
)
|
||||
assert applied == [6]
|
||||
backups = list(backup_dir.glob("app-pre-v5-*.db"))
|
||||
assert applied == [7]
|
||||
backups = list(backup_dir.glob("app-pre-v6-*.db"))
|
||||
assert len(backups) == 1
|
||||
check = sqlite3.connect(backups[0])
|
||||
try:
|
||||
@@ -174,7 +174,7 @@ def test_v5_normalizes_unfaved():
|
||||
)
|
||||
conn.commit()
|
||||
applied = run_migrations(conn)
|
||||
assert applied == [5]
|
||||
assert applied == [5, 6]
|
||||
rows = dict(conn.execute("SELECT aid, status FROM video").fetchall())
|
||||
assert rows == {1: "active", 2: "dropped"}
|
||||
finally:
|
||||
|
||||
Reference in new issue
Block a user