-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allows setting migrations format in the miskSchemaMigrator gradle
plugin declaration. `migrationsFormat` defaults to `TRADITIONAL`. Example: ```kts miskSchemaMigrator { // database = ... // host = ... migrationsFormat = "TRADITIONAL" } ``` GitOrigin-RevId: e128d450e398aa9577f8985f506dddd6234857be
- Loading branch information
1 parent
19cbecd
commit fd37f4c
Showing
13 changed files
with
66 additions
and
6 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
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
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
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
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
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
22 changes: 22 additions & 0 deletions
22
...resources/schema-migrator-plugin-test-with-declarative-migrations-format/build.gradle.kts
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,22 @@ | ||
import java.util.Properties | ||
|
||
plugins { | ||
id("com.squareup.misk.schema-migrator") | ||
} | ||
|
||
val properties = Properties().apply { | ||
val file = file("src/main/resources/db.properties") | ||
if (file.exists()) { | ||
load(file.inputStream()) | ||
} | ||
} | ||
|
||
miskSchemaMigrator { | ||
host = "localhost" | ||
port = 3306 | ||
database = properties.getProperty("schema") | ||
username = properties.getProperty("username") | ||
password = properties.getProperty("password") | ||
migrationsDir.set(layout.projectDirectory.dir("src/main/resources/db-migrations")) | ||
migrationsFormat = "DECLARATIVE" | ||
} |
1 change: 1 addition & 0 deletions
1
...esources/schema-migrator-plugin-test-with-declarative-migrations-format/gradle.properties
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 @@ | ||
org.gradle.configuration-cache=true |
1 change: 1 addition & 0 deletions
1
...ources/schema-migrator-plugin-test-with-declarative-migrations-format/settings.gradle.kts
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 @@ | ||
rootProject.name = "test" |
6 changes: 6 additions & 0 deletions
6
...lugin-test-with-declarative-migrations-format/src/main/resources/db-migrations/people.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 @@ | ||
CREATE TABLE people ( | ||
id BIGINT NOT NULL auto_increment, | ||
name VARCHAR(191) NOT NULL, | ||
nickname varchar(191) NOT NULL, | ||
PRIMARY KEY (id) | ||
); |
5 changes: 5 additions & 0 deletions
5
...st-with-declarative-migrations-format/src/main/resources/db-migrations/schema_version.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,5 @@ | ||
CREATE TABLE `schema_version` ( | ||
`version` varchar(50) COLLATE utf8mb4_bin NOT NULL, | ||
`installed_by` varchar(30) COLLATE utf8mb4_bin DEFAULT NULL, | ||
UNIQUE KEY `version` (`version`) | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin |
4 changes: 4 additions & 0 deletions
4
...-migrator-plugin-test-with-declarative-migrations-format/src/main/resources/db.properties
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 @@ | ||
jdbcUrl=jdbc:mysql://localhost:3306/ | ||
schema=schema_migrator_plugin_test_with_migrations_format | ||
username=root | ||
password= |
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