{"id":29966449,"url":"https://github.com/2u841r/preventsupabaseprojectpause","last_synced_at":"2026-04-17T06:33:42.863Z","repository":{"id":305531051,"uuid":"1023127866","full_name":"2u841r/PreventSupabaseProjectPause","owner":"2u841r","description":"Prevent Supabase Project Pause","archived":false,"fork":false,"pushed_at":"2025-07-20T16:17:23.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-29T01:59:10.839Z","etag":null,"topics":["deno","deno-deploy","supabase"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/2u841r.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-20T15:30:39.000Z","updated_at":"2025-07-20T16:17:26.000Z","dependencies_parsed_at":"2025-07-20T17:46:43.442Z","dependency_job_id":null,"html_url":"https://github.com/2u841r/PreventSupabaseProjectPause","commit_stats":null,"previous_names":["2u841r/preventsupabaseprojectpause"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/2u841r/PreventSupabaseProjectPause","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2u841r%2FPreventSupabaseProjectPause","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2u841r%2FPreventSupabaseProjectPause/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2u841r%2FPreventSupabaseProjectPause/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2u841r%2FPreventSupabaseProjectPause/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/2u841r","download_url":"https://codeload.github.com/2u841r/PreventSupabaseProjectPause/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2u841r%2FPreventSupabaseProjectPause/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268643714,"owners_count":24283314,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-04T02:00:09.867Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deno","deno-deploy","supabase"],"created_at":"2025-08-04T03:00:54.558Z","updated_at":"2026-04-17T06:33:42.792Z","avatar_url":"https://github.com/2u841r.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# PreventSupabaseProjectPause\n\n1. Visit your supabase project and get SUPABASE_URL, SUPABASE_KEY (SUPABASE_ANON_KEY)  \n(for this, you have to click on \u003ckbd\u003e Connect \u003c/kbd\u003e and click on App Framework then copy env.\n2. Visit [Deno Deploy](https://dash.deno.com/account/overview) and click on New Playgroud.  \n3. click on this icon\n\n\u003cimg width=\"538\" height=\"72\" alt=\"image\" src=\"https://github.com/user-attachments/assets/e543d0b2-cca5-48d3-bd0d-4d53393d3087\" /\u003e\n\nand add ENV values. 1. SUPABASE_URL1 2. SUPABASE_KEY1   \n\n4. use this code - (but don't forget to adjust your env variable keys). this is for 2 project alive with this code.\nif you have one project- then delete const supabase2 = createClient() and logTime(supabase2, \"Database 2\"),  \n\n```ts\nimport { createClient } from \"jsr:@supabase/supabase-js@2\";\n\nconst supabase1 = createClient(\n  Deno.env.get(\"SUPABASE_URL1\")!,\n  Deno.env.get(\"SUPABASE_KEY1\")!,\n);\n\nconst supabase2 = createClient(\n  Deno.env.get(\"SUPABASE_URL2\")!,\n  Deno.env.get(\"SUPABASE_KEY2\")!,\n);\n\n// Function to ensure table exists\nasync function ensureTableExists(supabase: any, tableName: string) {\n  try {\n    // Try to select from the table to check if it exists\n    const { error } = await supabase.from(tableName).select(\"*\").limit(1);\n    \n    if (error \u0026\u0026 error.code === \"42P01\") {\n      // Table doesn't exist, create it\n      console.log(`Creating table: ${tableName}`);\n      const { error: createError } = await supabase.rpc(\"create_time_logs_table\");\n      \n      if (createError) {\n        console.error(`Error creating table ${tableName}:`, createError);\n        return false;\n      }\n      console.log(`Table ${tableName} created successfully`);\n    }\n    return true;\n  } catch (err) {\n    console.error(`Error checking/creating table ${tableName}:`, err);\n    return false;\n  }\n}\n\n// Function to log time to database\nasync function logTime(supabase: any, dbName: string) {\n  const tableName = \"time_logs\";\n  \n  // Ensure table exists\n  const tableReady = await ensureTableExists(supabase, tableName);\n  if (!tableReady) return;\n\n  const currentTime = new Date().toISOString();\n  \n  try {\n    const { data, error } = await supabase\n      .from(tableName)\n      .insert({ logged_at: currentTime })\n      .select();\n\n    if (error) {\n      console.error(`Error inserting to ${dbName}:`, error);\n    } else {\n      console.log(`${dbName} - Time logged:`, currentTime);\n    }\n  } catch (err) {\n    console.error(`Exception in ${dbName}:`, err);\n  }\n}\n\n// Initialize tables on startup\nconsole.log(\"Initializing databases...\");\nawait Promise.all([\n  logTime(supabase1, \"Database 1\"),\n  logTime(supabase2, \"Database 2\"),\n]);\n\nDeno.cron(\"2MINCron\", \"*/2 * * * *\", async () =\u003e {\n  console.log(\"Cron triggered at:\", new Date().toISOString());\n  \n  // Log time to both databases\n  await Promise.all([\n    logTime(supabase1, \"Database 1\"),\n    logTime(supabase2, \"Database 2\"),\n  ]);\n});\n\nconsole.log(\"Service started - logging time every 2 minutes\");\n```\n\n5. create table and function on supabase Dashboard (Table Editor)  \n```sql\n   -- Create the time_logs table\nCREATE TABLE IF NOT EXISTS time_logs (\n  id SERIAL PRIMARY KEY,\n  logged_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()\n);\n\n-- Create a function to create the table (for the RPC call)\nCREATE OR REPLACE FUNCTION create_time_logs_table()\nRETURNS void\nLANGUAGE sql\nAS $$\n  CREATE TABLE IF NOT EXISTS time_logs (\n    id SERIAL PRIMARY KEY,\n    logged_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()\n  );\n$$;\n```\n6. Save \u0026 Deploy\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F2u841r%2Fpreventsupabaseprojectpause","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F2u841r%2Fpreventsupabaseprojectpause","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F2u841r%2Fpreventsupabaseprojectpause/lists"}