You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public class CustomDatabaseSeedProvider implements DatabaseSeedProvider {
169
+
170
+
@Override
171
+
public boolean matches(String uri) {
172
+
// Return true if uri is supported by this
173
+
// provider.
174
+
}
175
+
176
+
@Override
177
+
public InputStream stream(
178
+
String uri,
179
+
Map<String, Object> options) throws IOException {
180
+
// This method should obtain an input stream in an
181
+
// implementation specific way.
182
+
}
183
+
184
+
@Override
185
+
public void inject(Dependencies dependencies) {
186
+
// This method should provide implementation
187
+
// specific dependencies to the provider.
188
+
}
189
+
190
+
public static class CustomDependencies implements Dependencies {
191
+
@Override
192
+
public <T> T resolveDependency(Class<T> type) {
193
+
// This method should resolve dependencies
194
+
// required by the provider.
195
+
}
196
+
}
197
+
}
198
+
----
199
+
200
+
To implement the custom database seed provider, you must define three methods on the top-level `DatabaseSeedProvider` interface:
201
+
202
+
* A method to match the URIs that the provider can manage.
203
+
* A method to stream backups or dumps from a specified URI.
204
+
* A method to inject dependencies in the provider.
205
+
206
+
Additionally, you must implement a method on the nested `Dependencies` interface to resolve any dependencies required by your seed provider implementation.
207
+
208
+
Typically, the match method uses the URI scheme (the part specified before the first colon) to determine whether it can support the given URI or not.
209
+
For example, `file`, `http`, `https` etc.
210
+
211
+
The stream method should implement a scheme-specific way to obtain an input stream for the backup or dump.
212
+
213
+
Implementation-specific seed configuration can be passed through from options specified in the `CREATE DATABASE` command using `seedConfig`.
0 commit comments