summary refs log tree commit diff
path: root/scripts/db_migrations.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/db_migrations.sh')
-rwxr-xr-xscripts/db_migrations.sh13
1 files changed, 7 insertions, 6 deletions
diff --git a/scripts/db_migrations.sh b/scripts/db_migrations.sh
index 242b01f0..89404878 100755
--- a/scripts/db_migrations.sh
+++ b/scripts/db_migrations.sh
@@ -9,16 +9,17 @@ else
 fi
 
 [ -f ".env" ] && (
-    mv .env .env.tmp
-    source .env.tmp
+    mv .env .env.tmp 2>/dev/null
+    source .env.tmp 2>/dev/null
 )
+npm run build clean logerrors pretty-errors
 
 make_migration() {
     echo "Creating migrations for $2"
-    mkdir "src/util/migrations/$2"
+    mkdir "src/util/migrations/$2" 2>/dev/null
 #    npm run build clean logerrors pretty-errors
-#    THREADS=1 DATABASE="$1" DB_MIGRATE=a npm run start:bundle
-    THREADS=1 DATABASE="$1" DB_MIGRATE=a npx typeorm-ts-node-commonjs migration:generate "src/migrations/$2/$FILENAME" -d ../util/src/util/Database.ts -p
+    THREADS=1 DATABASE="$1" DB_MIGRATE=a npm run start:bundle
+    THREADS=1 DATABASE="$1" DB_MIGRATE=a npx typeorm-ts-node-commonjs migration:generate "src/migrations/$2/$FILENAME" -d src/util/util/Database.ts -p
     npm run build clean logerrors pretty-errors
     THREADS=1 DATABASE="$1" DB_MIGRATE=a npm run start:bundle
 }
@@ -36,5 +37,5 @@ make_migration "database.db" "sqlite"
     make_migration "$FC_DB_MARIADB" "mariadb"
 )
 
-[ -f ".env.tmp" ] && mv .env.tmp .env
+[ -f ".env.tmp" ] && mv .env.tmp .env 2>/dev/null