Skip to content

Commit

Permalink
Add database migration
Browse files Browse the repository at this point in the history
  • Loading branch information
robertdijk committed Oct 26, 2024
1 parent 8dc776d commit d43876a
Showing 1 changed file with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package db.migration;

import org.flywaydb.core.api.migration.BaseJavaMigration;
import org.flywaydb.core.api.migration.Context;

import java.sql.Statement;


/**
* DB migration which adds Transaction cost field.
*/
public class V202410026__Add_administration_costs extends BaseJavaMigration {

/**
* Executes this migration. The execution will automatically take place within a transaction, when the underlying
* database supports it.
*
* @param context of type Context
* @throws Exception when something is wrong
*/
public void migrate(Context context) throws Exception {
try (Statement select = context.getConnection().createStatement()) {
select.execute("ALTER TABLE public.orders ADD COLUMN administrationCosts DOUBLE PRECISION NOT NULL DEFAULT 0");
}
}

}

0 comments on commit d43876a

Please sign in to comment.