1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import process from "node:process";
import { turso } from "https://esm.town/v/stevekrouse/turso";
export const twitterFollowingsMigrations = (async () => {
let client = await turso({
url: process.env.tursoURL,
authToken: process.env.tursoToken,
});
return [
// await client.execute("drop table if exists twitter_follows"),
// await client.execute("drop table if exists twitter_users"),
// await client.execute(`create table twitter_users (
// twitter_id TEXT PRIMARY KEY,
// twitter_handle TEXT
// )`),
// await client.execute(`create table twitter_follows (
// follower_id TEXT,
// following_id TEXT,
// PRIMARY KEY (follower_id, following_id),
// FOREIGN KEY (follower_id) REFERENCES twitter_users (twitter_id),
// FOREIGN KEY (following_id) REFERENCES twitter_users (twitter_id)
// )`),
// await client.batch("write", [
// {
// sql: "insert into twitter_users values (:id, :handle)",
// args: { id: "431200836", handle: "stevekrouse" },
// },
// ]),
// await client.batch(
// "write",
// @stevekrouse.stevekrouseFollowing.map((id) => ({
// sql: "insert into twitter_users values (:id, :handle)",
// args: { id: id, handle: null },
// })),
// ),
// await client.batch(
// "write",
// @stevekrouse.stevekrouseFollowing.map((id) => ({
// sql: "insert into twitter_follows values (:follower, :following)",
// args: { follower: "431200836", following: id },
// })),
// ),
];
})();