jackson/migrate.sh

22 lines
360 B
Bash
Raw Normal View History

Feature/typeorm migrations (#141) * updated typeorm * renamed connection * updated migration scripts to new TypeORM version (v3) * typeorm and mongo -migrations and namespace column * update the mongo migration file * remove the camelcase * remove camelcase * rename the file * renaming migration files * folder restructuring and add migrate-mongo package * correcting path and minor changes * merging db name with URL * changing ts to js for mongo * migration automation with env variable * using custom scripts for migration * Dockerfile fixes * bootstrap script fixes and still need ts-node migrate-mongo in dockerfile * running migration in CI/CD * turning down planetscale * migration related fixes for namespace * Migration & bootstrap changes * reverting minor change * bootstrap.sh will only run in docker env * bootstrap RUN_MIGRATION env variable will use true * migration fixes * migration changes * removed console logs * planetscale migration fixes * copied back old files, tweaks to filenames * add index for namespace * restore older migration scripts * formatting * aligned timestamps * updated mysql, mariadb, mssql, planetscale namespace migrations * We'll run migrate manually as a separate step/container * forgot to add migrate.sh * bumped up timestamp * Enable planetscale testing * Revert planetscale test and comment config object * Revert deletions in Dockerfile * Update maria, mssql, mysql, ps, pg, sql namespace migrations * Cleanup * Add runMigration env to support manual run * Minor tweak * Ensure sql data migrations run after schema changes * Fix mssql namespace data migration query * Sync lock file * Update mongo timestamp * Set env for npm mongo migration script * [sql] Populate namespace column for synchronize: true instances * Rename `DB_RUN_MIGRATION` -> `DB_MANUAL_MIGRATION` * [mongo] Populate namespace for already deployed instances * Cleanup migrate.sh * [bash -> sh] bash does not work inside docker * Optimise migration artifacts * Source packages from global path * Copy npm from build context - excludes node_modules via .dockerignore * Remove redundant copy step * added swc packages * fresh package-lock * fresh package-lock * added migratepg job to skaffold fixes in migrate.sh to exit with error when migration fails * cleanup * added migratepg to demo skaffold as well * turn on planetscale tests --------- Co-authored-by: Deepak Prabhakara <deepak@boxyhq.com> Co-authored-by: Utkarsh Mehta <ukrocks.mehta@gmail.com> Co-authored-by: Aswin V <vaswin91@gmail.com>
2023-10-13 22:29:21 +00:00
#!/bin/sh
echo "Initiating Migration..."
export NODE_PATH=$(npm root -g)
cd ./npm
if [ "$DB_ENGINE" = "mongo" ]
then
migrate-mongo up
else
ts-node --transpile-only --project tsconfig.json $NODE_PATH/typeorm/cli.js migration:run -d ./typeorm.ts
fi
if [ $? -eq 1 ]
then
echo "Migration Failed..."
exit 1
fi
echo "Migration Finished..."
cd ..