Skip to content

Commit 4fb2665

Browse files
author
Jurij Skornik
committed
Reorder setup modes: fresh setup first, update second
- Mode 1 is now "Start fresh" with a warning about table deletion - Mode 2 is now "Update existing configuration" - Mode 3 remains "Add wallets only"
1 parent f0cda41 commit 4fb2665

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

packages/plugin-dkg-publisher/setup.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ async function bootstrapJournalForSetup(pool) {
165165

166166
if (tableCount < 4) {
167167
throw new Error(
168-
"Database is in a partial state (some tables missing). Please choose 'Start fresh' (option 2).",
168+
"Database is in a partial state (some tables missing). Please choose 'Start fresh' (option 1).",
169169
);
170170
}
171171

@@ -458,14 +458,14 @@ async function setup() {
458458
log(" • docker-compose.knowledge-manager.yml found", "cyan");
459459

460460
setupMode = await ask(
461-
"\nChoose setup mode:\n1. Update existing configuration\n2. Start fresh (will backup existing files)\n3. Add wallets only\nChoice (1-3):",
461+
"\nChoose setup mode:\n1. Start fresh (⚠️ will delete existing tables and backup config files)\n2. Update existing configuration\n3. Add wallets only\nChoice (1-3):",
462462
{
463463
validate: (input) => ["1", "2", "3"].includes(input),
464464
error: "Please enter 1, 2, or 3",
465465
},
466466
);
467467

468-
if (setupMode === "2") {
468+
if (setupMode === "1") {
469469
// Backup existing files
470470
const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
471471
try {
@@ -756,7 +756,7 @@ JWT_SECRET=${jwtSecret}
756756
# DATADOG_API_KEY=
757757
`;
758758

759-
const overwriteConfig = setupMode === "1" || setupMode === "2";
759+
const overwriteConfig = setupMode === "1" || setupMode === "2"; // Fresh or Update
760760
await createFile(".env.publisher", envContent, overwriteConfig);
761761

762762
// Skip wallet configuration file - wallets will be inserted directly into database
@@ -881,8 +881,8 @@ volumes:
881881
// Run Drizzle migrations to create/update tables
882882
log("Running database migrations...", "cyan");
883883

884-
// Check if this is a fresh start (Mode 2) — drop all tables first
885-
if (setupMode === "2" || !hasConfig) {
884+
// Check if this is a fresh start (Mode 1) — drop all tables first
885+
if (setupMode === "1" || !hasConfig) {
886886
log(" Dropping existing tables for fresh setup...", "white");
887887
await connection.execute("SET FOREIGN_KEY_CHECKS = 0");
888888
await connection.execute("DROP TABLE IF EXISTS __drizzle_migrations");

0 commit comments

Comments
 (0)