5import ValTown from "npm:@valtown/sdk";
6import SocialData from "../sdk/index.ts";
7import { setupDatabase, USAGE_TABLE } from "./database.ts";
8import { searchTwitterRoute } from "./routes/search.ts";
9
14
15// Uncomment this if you're forking this project:
16// await setupDatabase()
17
18// https://socialdata.gitbook.io/docs/pricing
3export const USAGE_TABLE = "socialDataProxy_usage_2";
4
5export async function setupDatabase() {
6 await sqlite.execute(`
7 CREATE TABLE IF NOT EXISTS ${USAGE_TABLE} (
1import { generateCode } from "./backend/generate-code";
2import { createTables } from "./database/migrations";
3import { createProject, getCode, getNextVersionNumber, insertVersion } from "./database/queries";
4
5async function servePublicFile(path: string): Promise<Response> {
3export const USAGE_TABLE = "socialDataProxy_usage_2";
4
5export async function setupDatabase() {
6 await sqlite.execute(`
7 CREATE TABLE IF NOT EXISTS ${USAGE_TABLE} (
1import { generateCode } from "./backend/generate-code";
2import { createTables } from "./database/migrations";
3import { createProject, getCode, getNextVersionNumber, insertVersion } from "./database/queries";
4
5async function servePublicFile(path: string): Promise<Response> {
1# Database Backup Cron Script
2
3This cron script is designed to automatically backup specific database tables using the `backupSQLiteDB` function. It groups tables and stores them as blobs for easy retrieval and management.
4
5## Overview
6
7The script imports a `backupDatabase` function from an external module and uses it to perform regular backups of specified database tables. It's set up as a cron job to run at scheduled intervals, ensuring your database is consistently backed up.
8
9## Main Function: handleBackup
11The `handleBackup` function is the core of this script. It takes the following parameters:
12
13- `DATABASE_PREFIX` (string): The prefix used for the database tables.
14- `DATABASE_TABLES` (string[]): An array of table names to be backed up.
15- `DATABASE_SUFFIX` (string, optional): A suffix to be added to the database names.
16
17## Imported Function
18
19The script relies on the `backupDatabase` function imported from:
20
21```typescript
22import backupDatabase from "https://esm.town/v/AIWB/backupSQLiteDB";
1# Database Backup Cron Script
2
3This cron script is designed to automatically backup specific database tables using the `backupSQLiteDB` function. It groups tables and stores them as blobs for easy retrieval and management.
4
5## Overview
6
7The script imports a `backupDatabase` function from an external module and uses it to perform regular backups of specified database tables. It's set up as a cron job to run at scheduled intervals, ensuring your database is consistently backed up.
8
9## Main Function: handleBackup
11The `handleBackup` function is the core of this script. It takes the following parameters:
12
13- `DATABASE_PREFIX` (string): The prefix used for the database tables.
14- `DATABASE_TABLES` (string[]): An array of table names to be backed up.
15- `DATABASE_SUFFIX` (string, optional): A suffix to be added to the database names.
16
17## Imported Function
18
19The script relies on the `backupDatabase` function imported from:
20
21```typescript
22import backupDatabase from "https://esm.town/v/AIWB/backupSQLiteDB";
1import { generateCode } from "./backend/generate-code";
2import { createTables } from "./database/migrations";
3import { createProject, getCode, getNextVersionNumber, insertVersion } from "./database/queries";
4
5async function servePublicFile(path: string): Promise<Response> {
5const SOCIAL_DATA_API_KEY = Deno.env.get("SOCIAL_DATA_API_KEY") || "";
6
7// Initialize SQLite database
8await sqlite.execute(`
9 CREATE TABLE IF NOT EXISTS cabinAdjacentTweets (
4import Chart from "https://esm.sh/chart.js/auto?deps=react@18.2.0,react-dom@18.2.0";
5
6// Comprehensive College Database (remains the same)
7const COLLEGES = [
8 // Top Tier IITs