-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #147 from ebean-orm/feature/add-fastmode
Add support for "*" for PatchResetChecksumOn to mean patch all mismatched checksums
- Loading branch information
Showing
9 changed files
with
59 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
ebean-migration/src/test/java/io/ebean/migration/MigrationRunner_PatchResetTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package io.ebean.migration; | ||
|
||
import io.ebean.datasource.DataSourceConfig; | ||
import io.ebean.datasource.DataSourceFactory; | ||
import io.ebean.datasource.DataSourcePool; | ||
import org.junit.jupiter.api.Test; | ||
|
||
class MigrationRunner_PatchResetTest { | ||
|
||
@Test | ||
void patchReset() { | ||
|
||
String url = "jdbc:h2:mem:patchReset"; | ||
DataSourceConfig dataSourceConfig = new DataSourceConfig() | ||
.setUrl(url) | ||
.setUsername("sa") | ||
.setPassword(""); | ||
|
||
DataSourcePool dataSource = DataSourceFactory.create("test", dataSourceConfig); | ||
|
||
MigrationConfig config = new MigrationConfig(); | ||
config.setPlatform("h2"); | ||
|
||
config.setMigrationPath("indexPatchReset_0"); | ||
MigrationRunner runner = new MigrationRunner(config); | ||
runner.run(dataSource); | ||
|
||
// add an index file now, expect automatically go to early mode + patch checksums | ||
config.setMigrationPath("indexPatchReset_1"); | ||
config.setPatchResetChecksumOn("*"); | ||
new MigrationRunner(config).run(dataSource); | ||
|
||
dataSource.shutdown(); | ||
} | ||
|
||
} |
6 changes: 6 additions & 0 deletions
6
ebean-migration/src/test/resources/indexPatchReset_0/1.0__initial.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
-- apply changes | ||
create table m1 ( | ||
id integer generated by default as identity not null, | ||
name varchar(255), | ||
constraint pk_m1 primary key (id) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
insert into m1 (name) values ('hi'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
create table m2 (acol varchar(10)); |
4 changes: 4 additions & 0 deletions
4
ebean-migration/src/test/resources/indexPatchReset_0/idx_h2.migrations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
1, 1.0__initial.sql | ||
2, 1.1.sql | ||
3, 1.2.sql | ||
|
6 changes: 6 additions & 0 deletions
6
ebean-migration/src/test/resources/indexPatchReset_1/1.0__initial.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
-- apply changes | ||
create table m1 ( | ||
id integer generated by default as identity not null, | ||
name varchar(255), | ||
constraint pk_m1 primary key (id) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
insert into m1 (name) values ('hi'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
create table m2 (acol varchar(10)); |