Empty Every EpiSODIC Table, Keeping the Schema Itself
Source:R/schema_migrate.R
episodic_db_truncate.RdA hard reset back to "freshly created, no data" - every row in every
EpiSODIC table is deleted, but the tables, indexes and constraints
stay exactly as episodic_db_create() built them, so the database is
immediately ready for a new episodic_run_cron() without a schema
migration. This includes episodic_app_user: dashboard accounts are
data too, and are deleted along with everything else - there is
nothing this function leaves behind to sign in with afterwards.
Arguments
- path
Path to an existing SQLite file, or a
mysql://DSN (seeepisodic_db_dsn_mariadb()) pointing at an existing MariaDB/MySQL database.
Value
Invisibly, the character vector of tables that were
truncated - character(0) if you cancelled, or if the database had
no EpiSODIC tables to begin with.
Details
Deliberately hard to trigger by accident:
- Interactive only
Refuses outright under
interactive()FALSE- a script, a cron job, or any other unattended context can never reach the confirmation prompt, so it can never reach the deletion either.- Typed confirmation
Prints exactly what is about to be deleted (every table, and its row count) and then requires you to type the database's own name back at a prompt. A bare yes/no is answerable on autopilot; typing the name back is not.