From 6ff78ceafb8d51cc6e7554085a726adbbf6ce22a Mon Sep 17 00:00:00 2001 From: Tsiry Sandratraina Date: Sun, 5 Oct 2025 13:33:14 +0300 Subject: [PATCH] feat: add pgpull crate for pulling data from PostgreSQL - Introduced a new crate `pgpull` with functionality to pull data from a remote PostgreSQL database. - Added `Cargo.toml` for `pgpull` with necessary dependencies. - Implemented `pull_data` function in `pgpull` to handle data pulling logic. - Updated `rockskyd` crate to include `pgpull` as a dependency. - Created a new command module `pull` in `rockskyd` to facilitate data pulling. - Enhanced the main application to support a new subcommand `pull` for executing the data pull operation. - Updated the journal with a new entry for the `woozy_saracen` version. --- .env.example | 4 +- Cargo.lock | 15 + apps/api/drizzle.config.ts | 2 +- apps/api/drizzle/0001_woozy_saracen.sql | 1 + apps/api/drizzle/meta/0001_snapshot.json | 3146 ++++++++++++++++++++++ apps/api/drizzle/meta/_journal.json | 7 + crates/pgpull/Cargo.toml | 24 + crates/pgpull/src/lib.rs | 16 + crates/rockskyd/Cargo.toml | 1 + crates/rockskyd/src/cmd/mod.rs | 1 + crates/rockskyd/src/cmd/pull.rs | 5 + crates/rockskyd/src/main.rs | 8 + 12 files changed, 3228 insertions(+), 2 deletions(-) create mode 100644 apps/api/drizzle/0001_woozy_saracen.sql create mode 100644 apps/api/drizzle/meta/0001_snapshot.json create mode 100644 crates/pgpull/Cargo.toml create mode 100644 crates/pgpull/src/lib.rs create mode 100644 crates/rockskyd/src/cmd/pull.rs diff --git a/.env.example b/.env.example index df2ab6d1..30de021d 100644 --- a/.env.example +++ b/.env.example @@ -13,4 +13,6 @@ JWT_SECRET= JETSTREAM_SERVER=wss://jetstream2.us-east.bsky.network -SCROBBLER_ORIGIN_URL="http://localhost:7882" \ No newline at end of file +SCROBBLER_ORIGIN_URL="http://localhost:7882" + +SOURCE_POSTGRES_URL= \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 1ce9643c..5967a6ef 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4967,6 +4967,20 @@ dependencies = [ "url", ] +[[package]] +name = "rocksky-pgpull" +version = "0.1.0" +dependencies = [ + "anyhow", + "chrono", + "owo-colors", + "serde", + "serde_json", + "sqlx", + "tokio", + "tracing", +] + [[package]] name = "rocksky-playlists" version = "0.1.0" @@ -5126,6 +5140,7 @@ dependencies = [ "rocksky-dropbox", "rocksky-googledrive", "rocksky-jetstream", + "rocksky-pgpull", "rocksky-playlists", "rocksky-scrobbler", "rocksky-spotify", diff --git a/apps/api/drizzle.config.ts b/apps/api/drizzle.config.ts index 6363f4b3..6790957f 100644 --- a/apps/api/drizzle.config.ts +++ b/apps/api/drizzle.config.ts @@ -5,6 +5,6 @@ export default defineConfig({ dialect: "postgresql", schema: "./src/schema", dbCredentials: { - url: process.env.POSTGRES_URL!, + url: process.env.XATA_POSTGRES_URL!, }, }); diff --git a/apps/api/drizzle/0001_woozy_saracen.sql b/apps/api/drizzle/0001_woozy_saracen.sql new file mode 100644 index 00000000..efc652b1 --- /dev/null +++ b/apps/api/drizzle/0001_woozy_saracen.sql @@ -0,0 +1 @@ +ALTER TABLE "artists" ADD COLUMN "genres" text[]; \ No newline at end of file diff --git a/apps/api/drizzle/meta/0001_snapshot.json b/apps/api/drizzle/meta/0001_snapshot.json new file mode 100644 index 00000000..00bc9abd --- /dev/null +++ b/apps/api/drizzle/meta/0001_snapshot.json @@ -0,0 +1,3146 @@ +{ + "id": "aeb183b0-c260-41fa-959b-2cde9fced54e", + "prevId": "49adc24b-83c8-4065-8e13-80045e7f0f27", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.album_tracks": { + "name": "album_tracks", + "schema": "", + "columns": { + "xata_id": { + "name": "xata_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "album_id": { + "name": "album_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "track_id": { + "name": "track_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "xata_createdat": { + "name": "xata_createdat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "xata_updatedat": { + "name": "xata_updatedat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "xata_version": { + "name": "xata_version", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "album_tracks_album_id_albums_xata_id_fk": { + "name": "album_tracks_album_id_albums_xata_id_fk", + "tableFrom": "album_tracks", + "tableTo": "albums", + "columnsFrom": [ + "album_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "album_tracks_track_id_tracks_xata_id_fk": { + "name": "album_tracks_track_id_tracks_xata_id_fk", + "tableFrom": "album_tracks", + "tableTo": "tracks", + "columnsFrom": [ + "track_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.albums": { + "name": "albums", + "schema": "", + "columns": { + "xata_id": { + "name": "xata_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "artist": { + "name": "artist", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "release_date": { + "name": "release_date", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "year": { + "name": "year", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "album_art": { + "name": "album_art", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "uri": { + "name": "uri", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "artist_uri": { + "name": "artist_uri", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "apple_music_link": { + "name": "apple_music_link", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "spotify_link": { + "name": "spotify_link", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tidal_link": { + "name": "tidal_link", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "youtube_link": { + "name": "youtube_link", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sha256": { + "name": "sha256", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "xata_createdat": { + "name": "xata_createdat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "xata_updatedat": { + "name": "xata_updatedat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "xata_version": { + "name": "xata_version", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "albums_uri_unique": { + "name": "albums_uri_unique", + "nullsNotDistinct": false, + "columns": [ + "uri" + ] + }, + "albums_apple_music_link_unique": { + "name": "albums_apple_music_link_unique", + "nullsNotDistinct": false, + "columns": [ + "apple_music_link" + ] + }, + "albums_spotify_link_unique": { + "name": "albums_spotify_link_unique", + "nullsNotDistinct": false, + "columns": [ + "spotify_link" + ] + }, + "albums_tidal_link_unique": { + "name": "albums_tidal_link_unique", + "nullsNotDistinct": false, + "columns": [ + "tidal_link" + ] + }, + "albums_youtube_link_unique": { + "name": "albums_youtube_link_unique", + "nullsNotDistinct": false, + "columns": [ + "youtube_link" + ] + }, + "albums_sha256_unique": { + "name": "albums_sha256_unique", + "nullsNotDistinct": false, + "columns": [ + "sha256" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.api_keys": { + "name": "api_keys", + "schema": "", + "columns": { + "xata_id": { + "name": "xata_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "api_key": { + "name": "api_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "shared_secret": { + "name": "shared_secret", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "enabled": { + "name": "enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "xata_createdat": { + "name": "xata_createdat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "xata_updatedat": { + "name": "xata_updatedat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "api_keys_user_id_users_xata_id_fk": { + "name": "api_keys_user_id_users_xata_id_fk", + "tableFrom": "api_keys", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.artist_albums": { + "name": "artist_albums", + "schema": "", + "columns": { + "xata_id": { + "name": "xata_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "artist_id": { + "name": "artist_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "album_id": { + "name": "album_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "xata_createdat": { + "name": "xata_createdat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "xata_updatedat": { + "name": "xata_updatedat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "xata_version": { + "name": "xata_version", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "artist_albums_artist_id_artists_xata_id_fk": { + "name": "artist_albums_artist_id_artists_xata_id_fk", + "tableFrom": "artist_albums", + "tableTo": "artists", + "columnsFrom": [ + "artist_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "artist_albums_album_id_albums_xata_id_fk": { + "name": "artist_albums_album_id_albums_xata_id_fk", + "tableFrom": "artist_albums", + "tableTo": "albums", + "columnsFrom": [ + "album_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.artist_tracks": { + "name": "artist_tracks", + "schema": "", + "columns": { + "xata_id": { + "name": "xata_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "artist_id": { + "name": "artist_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "track_id": { + "name": "track_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "xata_createdat": { + "name": "xata_createdat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "xata_updatedat": { + "name": "xata_updatedat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "xata_version": { + "name": "xata_version", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "artist_tracks_artist_id_artists_xata_id_fk": { + "name": "artist_tracks_artist_id_artists_xata_id_fk", + "tableFrom": "artist_tracks", + "tableTo": "artists", + "columnsFrom": [ + "artist_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "artist_tracks_track_id_tracks_xata_id_fk": { + "name": "artist_tracks_track_id_tracks_xata_id_fk", + "tableFrom": "artist_tracks", + "tableTo": "tracks", + "columnsFrom": [ + "track_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.artists": { + "name": "artists", + "schema": "", + "columns": { + "xata_id": { + "name": "xata_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "biography": { + "name": "biography", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "born": { + "name": "born", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "born_in": { + "name": "born_in", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "died": { + "name": "died", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "picture": { + "name": "picture", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sha256": { + "name": "sha256", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "uri": { + "name": "uri", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "apple_music_link": { + "name": "apple_music_link", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "spotify_link": { + "name": "spotify_link", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tidal_link": { + "name": "tidal_link", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "youtube_link": { + "name": "youtube_link", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "genres": { + "name": "genres", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "xata_createdat": { + "name": "xata_createdat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "xata_updatedat": { + "name": "xata_updatedat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "xata_version": { + "name": "xata_version", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "artists_sha256_unique": { + "name": "artists_sha256_unique", + "nullsNotDistinct": false, + "columns": [ + "sha256" + ] + }, + "artists_uri_unique": { + "name": "artists_uri_unique", + "nullsNotDistinct": false, + "columns": [ + "uri" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.dropbox_accounts": { + "name": "dropbox_accounts", + "schema": "", + "columns": { + "xata_id": { + "name": "xata_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_beta_user": { + "name": "is_beta_user", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "xata_version": { + "name": "xata_version", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "xata_createdat": { + "name": "xata_createdat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "xata_updatedat": { + "name": "xata_updatedat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "dropbox_accounts_user_id_users_xata_id_fk": { + "name": "dropbox_accounts_user_id_users_xata_id_fk", + "tableFrom": "dropbox_accounts", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "dropbox_accounts_email_unique": { + "name": "dropbox_accounts_email_unique", + "nullsNotDistinct": false, + "columns": [ + "email" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.dropbox_directories": { + "name": "dropbox_directories", + "schema": "", + "columns": { + "xata_id": { + "name": "xata_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "path": { + "name": "path", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "parent_id": { + "name": "parent_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "dropbox_id": { + "name": "dropbox_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "file_id": { + "name": "file_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "xata_version": { + "name": "xata_version", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "xata_createdat": { + "name": "xata_createdat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "xata_updatedat": { + "name": "xata_updatedat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "dropbox_directories_parent_id_dropbox_directories_xata_id_fk": { + "name": "dropbox_directories_parent_id_dropbox_directories_xata_id_fk", + "tableFrom": "dropbox_directories", + "tableTo": "dropbox_directories", + "columnsFrom": [ + "parent_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "dropbox_directories_file_id_unique": { + "name": "dropbox_directories_file_id_unique", + "nullsNotDistinct": false, + "columns": [ + "file_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.dropbox_paths": { + "name": "dropbox_paths", + "schema": "", + "columns": { + "xata_id": { + "name": "xata_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "path": { + "name": "path", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "dropbox_id": { + "name": "dropbox_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "track_id": { + "name": "track_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "directory_id": { + "name": "directory_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "file_id": { + "name": "file_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "xata_version": { + "name": "xata_version", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "xata_createdat": { + "name": "xata_createdat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "xata_updatedat": { + "name": "xata_updatedat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "dropbox_paths_directory_id_dropbox_directories_xata_id_fk": { + "name": "dropbox_paths_directory_id_dropbox_directories_xata_id_fk", + "tableFrom": "dropbox_paths", + "tableTo": "dropbox_directories", + "columnsFrom": [ + "directory_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "dropbox_paths_file_id_unique": { + "name": "dropbox_paths_file_id_unique", + "nullsNotDistinct": false, + "columns": [ + "file_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.dropbox_tokens": { + "name": "dropbox_tokens", + "schema": "", + "columns": { + "xata_id": { + "name": "xata_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "refresh_token": { + "name": "refresh_token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "xata_createdat": { + "name": "xata_createdat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "xata_updatedat": { + "name": "xata_updatedat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.dropbox": { + "name": "dropbox", + "schema": "", + "columns": { + "xata_id": { + "name": "xata_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "dropbox_token_id": { + "name": "dropbox_token_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "xata_version": { + "name": "xata_version", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "xata_createdat": { + "name": "xata_createdat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "xata_updatedat": { + "name": "xata_updatedat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "dropbox_user_id_users_xata_id_fk": { + "name": "dropbox_user_id_users_xata_id_fk", + "tableFrom": "dropbox", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "dropbox_dropbox_token_id_dropbox_tokens_xata_id_fk": { + "name": "dropbox_dropbox_token_id_dropbox_tokens_xata_id_fk", + "tableFrom": "dropbox", + "tableTo": "dropbox_tokens", + "columnsFrom": [ + "dropbox_token_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.google_drive_accounts": { + "name": "google_drive_accounts", + "schema": "", + "columns": { + "xata_id": { + "name": "xata_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_beta_user": { + "name": "is_beta_user", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "xata_version": { + "name": "xata_version", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "xata_createdat": { + "name": "xata_createdat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "xata_updatedat": { + "name": "xata_updatedat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "google_drive_accounts_user_id_users_xata_id_fk": { + "name": "google_drive_accounts_user_id_users_xata_id_fk", + "tableFrom": "google_drive_accounts", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "google_drive_accounts_email_unique": { + "name": "google_drive_accounts_email_unique", + "nullsNotDistinct": false, + "columns": [ + "email" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.google_drive_directories": { + "name": "google_drive_directories", + "schema": "", + "columns": { + "xata_id": { + "name": "xata_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "path": { + "name": "path", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "parent_id": { + "name": "parent_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "google_drive_id": { + "name": "google_drive_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "file_id": { + "name": "file_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "xata_version": { + "name": "xata_version", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "xata_createdat": { + "name": "xata_createdat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "xata_updatedat": { + "name": "xata_updatedat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "google_drive_directories_parent_id_google_drive_directories_xata_id_fk": { + "name": "google_drive_directories_parent_id_google_drive_directories_xata_id_fk", + "tableFrom": "google_drive_directories", + "tableTo": "google_drive_directories", + "columnsFrom": [ + "parent_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "google_drive_directories_file_id_unique": { + "name": "google_drive_directories_file_id_unique", + "nullsNotDistinct": false, + "columns": [ + "file_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.google_drive_paths": { + "name": "google_drive_paths", + "schema": "", + "columns": { + "xata_id": { + "name": "xata_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "google_drive_id": { + "name": "google_drive_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "track_id": { + "name": "track_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "directory_id": { + "name": "directory_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "file_id": { + "name": "file_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "xata_version": { + "name": "xata_version", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "xata_createdat": { + "name": "xata_createdat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "xata_updatedat": { + "name": "xata_updatedat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "google_drive_paths_directory_id_google_drive_directories_xata_id_fk": { + "name": "google_drive_paths_directory_id_google_drive_directories_xata_id_fk", + "tableFrom": "google_drive_paths", + "tableTo": "google_drive_directories", + "columnsFrom": [ + "directory_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "google_drive_paths_file_id_unique": { + "name": "google_drive_paths_file_id_unique", + "nullsNotDistinct": false, + "columns": [ + "file_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.google_drive_tokens": { + "name": "google_drive_tokens", + "schema": "", + "columns": { + "xata_id": { + "name": "xata_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "refresh_token": { + "name": "refresh_token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "xata_createdat": { + "name": "xata_createdat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "xata_updatedat": { + "name": "xata_updatedat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.google_drive": { + "name": "google_drive", + "schema": "", + "columns": { + "xata_id": { + "name": "xata_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "google_drive_token_id": { + "name": "google_drive_token_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "xata_version": { + "name": "xata_version", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "xata_createdat": { + "name": "xata_createdat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "xata_updatedat": { + "name": "xata_updatedat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "google_drive_google_drive_token_id_google_drive_tokens_xata_id_fk": { + "name": "google_drive_google_drive_token_id_google_drive_tokens_xata_id_fk", + "tableFrom": "google_drive", + "tableTo": "google_drive_tokens", + "columnsFrom": [ + "google_drive_token_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "google_drive_user_id_users_xata_id_fk": { + "name": "google_drive_user_id_users_xata_id_fk", + "tableFrom": "google_drive", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.loved_tracks": { + "name": "loved_tracks", + "schema": "", + "columns": { + "xata_id": { + "name": "xata_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "track_id": { + "name": "track_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "uri": { + "name": "uri", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "xata_createdat": { + "name": "xata_createdat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "loved_tracks_user_id_users_xata_id_fk": { + "name": "loved_tracks_user_id_users_xata_id_fk", + "tableFrom": "loved_tracks", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "loved_tracks_track_id_tracks_xata_id_fk": { + "name": "loved_tracks_track_id_tracks_xata_id_fk", + "tableFrom": "loved_tracks", + "tableTo": "tracks", + "columnsFrom": [ + "track_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "loved_tracks_uri_unique": { + "name": "loved_tracks_uri_unique", + "nullsNotDistinct": false, + "columns": [ + "uri" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.playlist_tracks": { + "name": "playlist_tracks", + "schema": "", + "columns": { + "xata_id": { + "name": "xata_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "playlist_id": { + "name": "playlist_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "track_id": { + "name": "track_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "xata_createdat": { + "name": "xata_createdat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "playlist_tracks_playlist_id_playlists_xata_id_fk": { + "name": "playlist_tracks_playlist_id_playlists_xata_id_fk", + "tableFrom": "playlist_tracks", + "tableTo": "playlists", + "columnsFrom": [ + "playlist_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "playlist_tracks_track_id_tracks_xata_id_fk": { + "name": "playlist_tracks_track_id_tracks_xata_id_fk", + "tableFrom": "playlist_tracks", + "tableTo": "tracks", + "columnsFrom": [ + "track_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.playlists": { + "name": "playlists", + "schema": "", + "columns": { + "xata_id": { + "name": "xata_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "picture": { + "name": "picture", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "uri": { + "name": "uri", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "spotify_link": { + "name": "spotify_link", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tidal_link": { + "name": "tidal_link", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "apple_music_link": { + "name": "apple_music_link", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "xata_createdat": { + "name": "xata_createdat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "xata_updatedat": { + "name": "xata_updatedat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "playlists_created_by_users_xata_id_fk": { + "name": "playlists_created_by_users_xata_id_fk", + "tableFrom": "playlists", + "tableTo": "users", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "playlists_uri_unique": { + "name": "playlists_uri_unique", + "nullsNotDistinct": false, + "columns": [ + "uri" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.profile_shouts": { + "name": "profile_shouts", + "schema": "", + "columns": { + "xata_id": { + "name": "xata_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "shout_id": { + "name": "shout_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "xata_createdat": { + "name": "xata_createdat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "profile_shouts_user_id_users_xata_id_fk": { + "name": "profile_shouts_user_id_users_xata_id_fk", + "tableFrom": "profile_shouts", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "profile_shouts_shout_id_shouts_xata_id_fk": { + "name": "profile_shouts_shout_id_shouts_xata_id_fk", + "tableFrom": "profile_shouts", + "tableTo": "shouts", + "columnsFrom": [ + "shout_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.queue_tracks": { + "name": "queue_tracks", + "schema": "", + "columns": { + "xata_id": { + "name": "xata_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "track_id": { + "name": "track_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "position": { + "name": "position", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "file_uri": { + "name": "file_uri", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "xata_version": { + "name": "xata_version", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "xata_createdat": { + "name": "xata_createdat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "xata_updatedat": { + "name": "xata_updatedat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "queue_tracks_user_id_users_xata_id_fk": { + "name": "queue_tracks_user_id_users_xata_id_fk", + "tableFrom": "queue_tracks", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "queue_tracks_track_id_tracks_xata_id_fk": { + "name": "queue_tracks_track_id_tracks_xata_id_fk", + "tableFrom": "queue_tracks", + "tableTo": "tracks", + "columnsFrom": [ + "track_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.scrobbles": { + "name": "scrobbles", + "schema": "", + "columns": { + "xata_id": { + "name": "xata_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "track_id": { + "name": "track_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "album_id": { + "name": "album_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "artist_id": { + "name": "artist_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "uri": { + "name": "uri", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "xata_createdat": { + "name": "xata_createdat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "xata_updatedat": { + "name": "xata_updatedat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "xata_version": { + "name": "xata_version", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "timestamp": { + "name": "timestamp", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "scrobbles_user_id_users_xata_id_fk": { + "name": "scrobbles_user_id_users_xata_id_fk", + "tableFrom": "scrobbles", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "scrobbles_track_id_tracks_xata_id_fk": { + "name": "scrobbles_track_id_tracks_xata_id_fk", + "tableFrom": "scrobbles", + "tableTo": "tracks", + "columnsFrom": [ + "track_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "scrobbles_album_id_albums_xata_id_fk": { + "name": "scrobbles_album_id_albums_xata_id_fk", + "tableFrom": "scrobbles", + "tableTo": "albums", + "columnsFrom": [ + "album_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "scrobbles_artist_id_artists_xata_id_fk": { + "name": "scrobbles_artist_id_artists_xata_id_fk", + "tableFrom": "scrobbles", + "tableTo": "artists", + "columnsFrom": [ + "artist_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "scrobbles_uri_unique": { + "name": "scrobbles_uri_unique", + "nullsNotDistinct": false, + "columns": [ + "uri" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.shout_likes": { + "name": "shout_likes", + "schema": "", + "columns": { + "xata_id": { + "name": "xata_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "shout_id": { + "name": "shout_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "xata_createdat": { + "name": "xata_createdat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "uri": { + "name": "uri", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "shout_likes_user_id_users_xata_id_fk": { + "name": "shout_likes_user_id_users_xata_id_fk", + "tableFrom": "shout_likes", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "shout_likes_shout_id_shouts_xata_id_fk": { + "name": "shout_likes_shout_id_shouts_xata_id_fk", + "tableFrom": "shout_likes", + "tableTo": "shouts", + "columnsFrom": [ + "shout_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "shout_likes_uri_unique": { + "name": "shout_likes_uri_unique", + "nullsNotDistinct": false, + "columns": [ + "uri" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.shout_reports": { + "name": "shout_reports", + "schema": "", + "columns": { + "xata_id": { + "name": "xata_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "shout_id": { + "name": "shout_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "xata_createdat": { + "name": "xata_createdat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "shout_reports_user_id_users_xata_id_fk": { + "name": "shout_reports_user_id_users_xata_id_fk", + "tableFrom": "shout_reports", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "shout_reports_shout_id_shouts_xata_id_fk": { + "name": "shout_reports_shout_id_shouts_xata_id_fk", + "tableFrom": "shout_reports", + "tableTo": "shouts", + "columnsFrom": [ + "shout_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.shouts": { + "name": "shouts", + "schema": "", + "columns": { + "xata_id": { + "name": "xata_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "track_id": { + "name": "track_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "artist_id": { + "name": "artist_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "album_id": { + "name": "album_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "scrobble_id": { + "name": "scrobble_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "uri": { + "name": "uri", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "author_id": { + "name": "author_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "parent_id": { + "name": "parent_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "xata_createdat": { + "name": "xata_createdat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "xata_updatedat": { + "name": "xata_updatedat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "shouts_track_id_tracks_xata_id_fk": { + "name": "shouts_track_id_tracks_xata_id_fk", + "tableFrom": "shouts", + "tableTo": "tracks", + "columnsFrom": [ + "track_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "shouts_artist_id_users_xata_id_fk": { + "name": "shouts_artist_id_users_xata_id_fk", + "tableFrom": "shouts", + "tableTo": "users", + "columnsFrom": [ + "artist_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "shouts_album_id_albums_xata_id_fk": { + "name": "shouts_album_id_albums_xata_id_fk", + "tableFrom": "shouts", + "tableTo": "albums", + "columnsFrom": [ + "album_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "shouts_scrobble_id_scrobbles_xata_id_fk": { + "name": "shouts_scrobble_id_scrobbles_xata_id_fk", + "tableFrom": "shouts", + "tableTo": "scrobbles", + "columnsFrom": [ + "scrobble_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "shouts_author_id_users_xata_id_fk": { + "name": "shouts_author_id_users_xata_id_fk", + "tableFrom": "shouts", + "tableTo": "users", + "columnsFrom": [ + "author_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "shouts_parent_id_shouts_xata_id_fk": { + "name": "shouts_parent_id_shouts_xata_id_fk", + "tableFrom": "shouts", + "tableTo": "shouts", + "columnsFrom": [ + "parent_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "shouts_uri_unique": { + "name": "shouts_uri_unique", + "nullsNotDistinct": false, + "columns": [ + "uri" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.spotify_accounts": { + "name": "spotify_accounts", + "schema": "", + "columns": { + "xata_id": { + "name": "xata_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "xata_version": { + "name": "xata_version", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "is_beta_user": { + "name": "is_beta_user", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "xata_createdat": { + "name": "xata_createdat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "xata_updatedat": { + "name": "xata_updatedat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "spotify_accounts_user_id_users_xata_id_fk": { + "name": "spotify_accounts_user_id_users_xata_id_fk", + "tableFrom": "spotify_accounts", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.spotify_tokens": { + "name": "spotify_tokens", + "schema": "", + "columns": { + "xata_id": { + "name": "xata_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "xata_version": { + "name": "xata_version", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "access_token": { + "name": "access_token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "refresh_token": { + "name": "refresh_token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "xata_createdat": { + "name": "xata_createdat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "xata_updatedat": { + "name": "xata_updatedat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "spotify_tokens_user_id_users_xata_id_fk": { + "name": "spotify_tokens_user_id_users_xata_id_fk", + "tableFrom": "spotify_tokens", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tracks": { + "name": "tracks", + "schema": "", + "columns": { + "xata_id": { + "name": "xata_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "artist": { + "name": "artist", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "album_artist": { + "name": "album_artist", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "album_art": { + "name": "album_art", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "album": { + "name": "album", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "track_number": { + "name": "track_number", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "duration": { + "name": "duration", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "mb_id": { + "name": "mb_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "youtube_link": { + "name": "youtube_link", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "spotify_link": { + "name": "spotify_link", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "apple_music_link": { + "name": "apple_music_link", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tidal_link": { + "name": "tidal_link", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sha256": { + "name": "sha256", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "disc_number": { + "name": "disc_number", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "lyrics": { + "name": "lyrics", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "composer": { + "name": "composer", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "genre": { + "name": "genre", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "copyright_message": { + "name": "copyright_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "uri": { + "name": "uri", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "album_uri": { + "name": "album_uri", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "artist_uri": { + "name": "artist_uri", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "xata_createdat": { + "name": "xata_createdat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "xata_updatedat": { + "name": "xata_updatedat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "xata_version": { + "name": "xata_version", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "tracks_mb_id_unique": { + "name": "tracks_mb_id_unique", + "nullsNotDistinct": false, + "columns": [ + "mb_id" + ] + }, + "tracks_youtube_link_unique": { + "name": "tracks_youtube_link_unique", + "nullsNotDistinct": false, + "columns": [ + "youtube_link" + ] + }, + "tracks_spotify_link_unique": { + "name": "tracks_spotify_link_unique", + "nullsNotDistinct": false, + "columns": [ + "spotify_link" + ] + }, + "tracks_apple_music_link_unique": { + "name": "tracks_apple_music_link_unique", + "nullsNotDistinct": false, + "columns": [ + "apple_music_link" + ] + }, + "tracks_tidal_link_unique": { + "name": "tracks_tidal_link_unique", + "nullsNotDistinct": false, + "columns": [ + "tidal_link" + ] + }, + "tracks_sha256_unique": { + "name": "tracks_sha256_unique", + "nullsNotDistinct": false, + "columns": [ + "sha256" + ] + }, + "tracks_uri_unique": { + "name": "tracks_uri_unique", + "nullsNotDistinct": false, + "columns": [ + "uri" + ] + }, + "tracks_album_uri_unique": { + "name": "tracks_album_uri_unique", + "nullsNotDistinct": false, + "columns": [ + "album_uri" + ] + }, + "tracks_artist_uri_unique": { + "name": "tracks_artist_uri_unique", + "nullsNotDistinct": false, + "columns": [ + "artist_uri" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_albums": { + "name": "user_albums", + "schema": "", + "columns": { + "xata_id": { + "name": "xata_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "album_id": { + "name": "album_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "xata_createdat": { + "name": "xata_createdat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "xata_updatedat": { + "name": "xata_updatedat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "xata_version": { + "name": "xata_version", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "scrobbles": { + "name": "scrobbles", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uri": { + "name": "uri", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "user_albums_user_id_users_xata_id_fk": { + "name": "user_albums_user_id_users_xata_id_fk", + "tableFrom": "user_albums", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "user_albums_album_id_albums_xata_id_fk": { + "name": "user_albums_album_id_albums_xata_id_fk", + "tableFrom": "user_albums", + "tableTo": "albums", + "columnsFrom": [ + "album_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "user_albums_uri_unique": { + "name": "user_albums_uri_unique", + "nullsNotDistinct": false, + "columns": [ + "uri" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_artists": { + "name": "user_artists", + "schema": "", + "columns": { + "xata_id": { + "name": "xata_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "artist_id": { + "name": "artist_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "xata_createdat": { + "name": "xata_createdat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "xata_updatedat": { + "name": "xata_updatedat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "xata_version": { + "name": "xata_version", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "scrobbles": { + "name": "scrobbles", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uri": { + "name": "uri", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "user_artists_user_id_users_xata_id_fk": { + "name": "user_artists_user_id_users_xata_id_fk", + "tableFrom": "user_artists", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "user_artists_artist_id_artists_xata_id_fk": { + "name": "user_artists_artist_id_artists_xata_id_fk", + "tableFrom": "user_artists", + "tableTo": "artists", + "columnsFrom": [ + "artist_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "user_artists_uri_unique": { + "name": "user_artists_uri_unique", + "nullsNotDistinct": false, + "columns": [ + "uri" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_playlists": { + "name": "user_playlists", + "schema": "", + "columns": { + "xata_id": { + "name": "xata_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "playlist_id": { + "name": "playlist_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "xata_createdat": { + "name": "xata_createdat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "uri": { + "name": "uri", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "user_playlists_user_id_users_xata_id_fk": { + "name": "user_playlists_user_id_users_xata_id_fk", + "tableFrom": "user_playlists", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "user_playlists_playlist_id_tracks_xata_id_fk": { + "name": "user_playlists_playlist_id_tracks_xata_id_fk", + "tableFrom": "user_playlists", + "tableTo": "tracks", + "columnsFrom": [ + "playlist_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "user_playlists_uri_unique": { + "name": "user_playlists_uri_unique", + "nullsNotDistinct": false, + "columns": [ + "uri" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_tracks": { + "name": "user_tracks", + "schema": "", + "columns": { + "xata_id": { + "name": "xata_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "track_id": { + "name": "track_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "xata_createdat": { + "name": "xata_createdat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "xata_updatedat": { + "name": "xata_updatedat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "xata_version": { + "name": "xata_version", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "uri": { + "name": "uri", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "scrobbles": { + "name": "scrobbles", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "user_tracks_user_id_users_xata_id_fk": { + "name": "user_tracks_user_id_users_xata_id_fk", + "tableFrom": "user_tracks", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "user_tracks_track_id_tracks_xata_id_fk": { + "name": "user_tracks_track_id_tracks_xata_id_fk", + "tableFrom": "user_tracks", + "tableTo": "tracks", + "columnsFrom": [ + "track_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "user_tracks_uri_unique": { + "name": "user_tracks_uri_unique", + "nullsNotDistinct": false, + "columns": [ + "uri" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.users": { + "name": "users", + "schema": "", + "columns": { + "xata_id": { + "name": "xata_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "did": { + "name": "did", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "display_name": { + "name": "display_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "handle": { + "name": "handle", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "avatar": { + "name": "avatar", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "xata_createdat": { + "name": "xata_createdat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "xata_updatedat": { + "name": "xata_updatedat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "xata_version": { + "name": "xata_version", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "users_did_unique": { + "name": "users_did_unique", + "nullsNotDistinct": false, + "columns": [ + "did" + ] + }, + "users_handle_unique": { + "name": "users_handle_unique", + "nullsNotDistinct": false, + "columns": [ + "handle" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.webscrobblers": { + "name": "webscrobblers", + "schema": "", + "columns": { + "xata_id": { + "name": "xata_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "uuid": { + "name": "uuid", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "enabled": { + "name": "enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "xata_createdat": { + "name": "xata_createdat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "xata_updatedat": { + "name": "xata_updatedat", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "webscrobblers_user_id_users_xata_id_fk": { + "name": "webscrobblers_user_id_users_xata_id_fk", + "tableFrom": "webscrobblers", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "xata_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": {}, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/apps/api/drizzle/meta/_journal.json b/apps/api/drizzle/meta/_journal.json index 7b72c3b3..33f335e0 100644 --- a/apps/api/drizzle/meta/_journal.json +++ b/apps/api/drizzle/meta/_journal.json @@ -8,6 +8,13 @@ "when": 1753405608015, "tag": "0000_quiet_mister_sinister", "breakpoints": true + }, + { + "idx": 1, + "version": "7", + "when": 1759657577245, + "tag": "0001_woozy_saracen", + "breakpoints": true } ] } \ No newline at end of file diff --git a/crates/pgpull/Cargo.toml b/crates/pgpull/Cargo.toml new file mode 100644 index 00000000..3115eadb --- /dev/null +++ b/crates/pgpull/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "rocksky-pgpull" +version = "0.1.0" +authors.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true + +[dependencies] +serde = { version = "1.0.217", features = ["derive"] } +serde_json = "1.0.139" +sqlx = { version = "0.8.3", features = [ + "runtime-tokio", + "tls-rustls", + "postgres", + "chrono", + "derive", + "macros", +] } +tokio = { version = "1.43.0", features = ["full"] } +chrono = { version = "= 0.4.39", features = ["serde"] } +owo-colors = "4.1.0" +anyhow = "1.0.96" +tracing = "0.1.41" diff --git a/crates/pgpull/src/lib.rs b/crates/pgpull/src/lib.rs new file mode 100644 index 00000000..80557829 --- /dev/null +++ b/crates/pgpull/src/lib.rs @@ -0,0 +1,16 @@ +use std::env; + +use anyhow::Error; + +pub async fn pull_data() -> Result<(), Error> { + if env::var("SOURCE_POSTGRES_URL").is_err() { + tracing::error!( + "SOURCE_POSTGRES_URL is not set. Please set it to your PostgreSQL connection string." + ); + std::process::exit(1); + } + + // Placeholder for the actual data pulling logic from PostgreSQL + println!("Pulling data from PostgreSQL..."); + Ok(()) +} diff --git a/crates/rockskyd/Cargo.toml b/crates/rockskyd/Cargo.toml index a4071daf..27fa91f0 100644 --- a/crates/rockskyd/Cargo.toml +++ b/crates/rockskyd/Cargo.toml @@ -20,6 +20,7 @@ rocksky-scrobbler = { path = "../scrobbler" } rocksky-spotify = { path = "../spotify" } rocksky-tracklist = { path = "../tracklist" } rocksky-webscrobbler = { path = "../webscrobbler" } +rocksky-pgpull = { path = "../pgpull" } tracing = "0.1.41" tracing-subscriber = "0.3.20" tracing-log = "0.2.0" diff --git a/crates/rockskyd/src/cmd/mod.rs b/crates/rockskyd/src/cmd/mod.rs index 74b52f72..ecb9bbd7 100644 --- a/crates/rockskyd/src/cmd/mod.rs +++ b/crates/rockskyd/src/cmd/mod.rs @@ -3,6 +3,7 @@ pub mod dropbox; pub mod googledrive; pub mod jetstream; pub mod playlist; +pub mod pull; pub mod scrobbler; pub mod spotify; pub mod tracklist; diff --git a/crates/rockskyd/src/cmd/pull.rs b/crates/rockskyd/src/cmd/pull.rs new file mode 100644 index 00000000..3dfa664a --- /dev/null +++ b/crates/rockskyd/src/cmd/pull.rs @@ -0,0 +1,5 @@ +use anyhow::Error; + +pub async fn pull_data() -> Result<(), Error> { + rocksky_pgpull::pull_data().await +} diff --git a/crates/rockskyd/src/main.rs b/crates/rockskyd/src/main.rs index 20b6310f..fafad3d9 100644 --- a/crates/rockskyd/src/main.rs +++ b/crates/rockskyd/src/main.rs @@ -32,6 +32,11 @@ fn cli() -> Command { .subcommand(Command::new("spotify").about("Start Spotify Listener Service")) .subcommand(Command::new("tracklist").about("Start User Current Track Queue Service")) .subcommand(Command::new("webscrobbler").about("Start Webscrobbler API")) + .subcommand( + Command::new("pull") + .about("Pull data from a remote PostgreSQL database to your local PostgresSQL instance") + .long_about("Pull data from a remote PostgreSQL database to your local PostgresSQL instance. Ensure that the SOURCE_POSTGRES_URL environment variable is set to your remote PostgreSQL connection string."), + ) } #[tokio::main] @@ -85,6 +90,9 @@ async fn main() -> Result<(), Box> { Some(("webscrobbler", _)) => { cmd::webscrobbler::start_webscrobbler_service().await?; } + Some(("pull", _)) => { + cmd::pull::pull_data().await?; + } _ => { println!("No valid subcommand was used. Use --help to see available commands."); } -- 2.51.2