How to create flyway history for exiting database - spring-boot

With my Spring Boot app, I have a database that is already set up but the flyway history table is empty. I would like to run flyway to generate the history table from the migration files.
When I run flyway:migrate it does not understand that my database credentials are in application.yml so I had to use a config file as below:
Approach1:
mvn -D flyway.configFiles=flyway.config -D flyway.baselineVersion=14 -D flyway.locations=classpath:db.development flyway:baseline
No error but it does not generate migration history.
Approach2:
mvn -D flyway.configFiles=flyway.config -D flywaytarget=14 -D flyway.skipExecutingMigrations=true -D flyway.locations=classpath:db.development flyway:migrate
Gives me an error:
org.flywaydb.core.api.FlywayException: Unknown configuration property: flyway.skipExecutingMigrations
Any idea how to achieve my goal?

Related

ClientLibs are not getting updated and resources folder getting deleted after mvn clean install

I am using AEM cloud SDK with archetypeVersion 39 project after running mvn clean install my clientlib folders are not getting updated (issue is with only clientlibs rest are working as expected)and even I observed that the folder which I have added most recently i.e., resources is getting deleted PFB looks like this. I have created project by using the below command : mvn -B org.apache.maven.plugins:maven-archetype-plugin:3.2.1:generate -D archetypeGroupId=com.adobe.aem -D archetypeArtifactId=aem-project-archetype -D archetypeVersion=39 -D appTitle="WKND Sites Project" -D appId="wknd" -D groupId="com.adobe.aem.guides" -D artifactId="aem-guides-wknd" -D package="com.adobe.aem.guides.wknd" -D version="0.0.1-SNAPSHOT" -D aemVersion="cloud"
enter image description here
enter image description here

How to incrementally update changelog?

I've generated changelog with
java -jar liquibase.jar --changeLogFile="./data/<insert file name>" generateChangeLog
I've got a "create table" changelog.
After it I altered table by adding a new column and runned
java -jar liquibase.jar --changeLogFile="./data/<insert file name>"
generateChangeLog
again. I expected to see incremental log with "create table" and "alter table", but it showing "ChangeLog ...... already exists!".
How to incrementally update ChangeLog?
Thank you!
The generateChangelog command is used to generate an initial changelog. If you want to append to a changelog you use the diffChangelog command.

Parse Cloud Code Deploy

I am currently setting up Parse Cloud Code and I have gotten to the final step which is to deploy the main.js file but when I do this it just opens the file in Adobe Dreamweaver?
I was having problems understanding how to deploy the main.js file.
Read the following steps: https://www.parse.com/apps/quickstart#cloud_code/unix
It contains:
Get the Parse tool
Download the command line tool by running this command:
curl -s https://www.parse.com/downloads/cloud_code/installer.sh | sudo /bin/bash
This installs a tool named parse to /usr/local/bin/parse. That is the only thing that's added, so to uninstall, just delete that file. Running this command will also update your existing Parse command line tool if you already have it installed.
Set up a Cloud Code directory
Open a new terminal window, run the command parse new and follow the instructions.
$ parse new
Please login to Parse using your email and password.
Email: ninja#gmail.com
Password (will be hidden):
Would you like to create a new app, or add Cloud Code to an existing app?
Type "new" or "existing": existing
1:MyApp
2:MyOtherApp
Select an App to add to config: 1
Awesome! Now it's time to setup some Cloud Code for the app: "MyApp",
Next we will create a directory to hold your Cloud Code.
Please enter the name to use for this directory, or hit ENTER to use
"MyApp" as the directory name.
Directory Name: MyCloudCode
Your Cloud Code has been created at ${CLOUD_CODE_DIR}.
Next, you might want to deploy this code with
"parse deploy"
.
This includes a "Hello world" cloud function, so once you deploy
you can test that it works, with:
curl -X POST \
-H "X-Parse-Application-Id: ${APP_ID}" \
-H "X-Parse-REST-API-Key: ${REST_API_KEY}" \
-H "Content-Type: application/json" \
-d '{}' \
https://api.parse.com/1/functions/hello
$ cd MyCloudCode
Go to the directory where your Main.js file does exist and
use command $parse deploy to deploy your code on parse cloud.Refer this link if you are using Linux system.https://www.parse.com/apps/quickstart#cloud_code/unix and use this link if you are using windows system https://parse.com/apps/quickstart#cloud_code/windows.
Hope it will help.
As far as I understand from your question, you want to deploy the main.js file to the Parse cloud. The problem that you face opening in Adobe Dreamweaver is related with your computer where you configure the file open with the Adobe Dreamweaver.
The answer to your question is; as detailed in Parse Cloud tutorial, first you have to install Parse command line tool. This tool enables you to manage your code in Parse cloud. Then you can use "parse new" command to set up a cloud directory where you have to replace the main.js file with your own. Following that "parse deploy" will deploy your js file to the Parse cloud. You can find detailed information in tutorials Parse Cloud. Hope this helps.
Regards.

ActiveRecord::PendingMigrationError after restore of local database from Heroku

I have an app on Heroku (which is up to date and has run the latest migrations), when I download the database to my local postgresql database with this script:
heroku pgbackups:capture --expire --app myapp
echo "Captured database on heroku"
curl -o latest.dump `heroku pgbackups:url --app myapp`
echo "Downloaded database"
pg_restore --verbose --clean --no-acl --no-owner -h localhost -d cooking latest.dump
echo "Database restored"
And I start my local server I get an error like this:
ActiveRecord::PendingMigrationError
Migrations are pending; run 'bin/rake db:migrate RAILS_ENV=development' to resolve this issue.
I have tried deleting and resetting my old database with no change.
This error occurs when the version of the database (accessible via ActiveRecord::Migrator.current_version in Rails or select max(version) from schema_migrations with SQL) is less than the highest migration version, as loaded from db/migrate and typically encoded in the filenames of the files in that directory.
It doesn't matter what you do to your database in terms of running migrations or resetting it as long as you are replacing it with the Heroku version afterwards. At that point, all that matters is how your database contents compare to the migrations in db/migrate.

Failure using heroku pg:transfer

I'm trying to use heroku pg:transfer to transfer my local database to Heroku.
Here is the command that I'm running
heroku pg:transfer -f postgres://<username>:<password>#localhost:5432/<db_name> -t postgres://<app_path>.compute-1.amazonaws.com:5432/<stuff> --app <app_name> --confirm <app_name>
and I'm getting the following error messages
pg_restore: [archiver] did not find magic string in file header
pg_dump: [custom archiver] could not write to output file: Invalid argument
pg_dump: *** aborted because of error
I'm using Postgres on Windows. Does anyone know how to fix this?
Import
PG Backups can be used as a convenient tool to import database dumps from other sources to your Heroku Postgres database.
Dump your local database in compressed format using the open source pg_dump tool:
$ PGPASSWORD=mypassword pg_dump -Fc --no-acl --no-owner -h localhost -U myuser mydb > mydb.dump
Import to Heroku Postgres
In order for PG Backups to access and import your dump file you will need to upload it somewhere with an HTTP-accessible URL. We recommend using Amazon S3.
Use the raw file URL in the pgbackups:restore command:
Be sure to use single quotes around the temporary S3 URL, as it
contains ampersands and other characters that will confuse your shell
otherwise.

Resources