[
https://issues.apache.org/jira/browse/NIFIREG-173?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16500370#comment-16500370
]
ASF GitHub Bot commented on NIFIREG-173:
----------------------------------------
Github user kevdoran commented on a diff in the pull request:
https://github.com/apache/nifi-registry/pull/121#discussion_r192781546
--- Diff:
nifi-registry-framework/src/main/java/org/apache/nifi/registry/db/CustomFlywayMigrationStrategy.java
---
@@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.registry.db;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.nifi.registry.db.migration.BucketEntityV1;
+import org.apache.nifi.registry.db.migration.FlowEntityV1;
+import org.apache.nifi.registry.db.migration.FlowSnapshotEntityV1;
+import org.apache.nifi.registry.db.migration.LegacyDataSourceFactory;
+import org.apache.nifi.registry.db.migration.LegacyDatabaseService;
+import org.apache.nifi.registry.db.migration.LegacyEntityMapper;
+import org.apache.nifi.registry.properties.NiFiRegistryProperties;
+import org.apache.nifi.registry.service.MetadataService;
+import org.flywaydb.core.Flyway;
+import org.flywaydb.core.api.FlywayException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import
org.springframework.boot.autoconfigure.flyway.FlywayMigrationStrategy;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.stereotype.Component;
+
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.List;
+
+/**
+ * Custom Flyway migration strategy that lets us perform data migration
from the original database used in the
+ * 0.1.0 release, to the new database. The data migration will be
triggered when it is determined that new database
+ * is brand new AND the legacy DB properties are specified. If the primary
database already contains the 'BUCKET' table,
+ * or if the legacy database properties are not specified, then no data
migration is performed.
+ */
+@Component
+public class CustomFlywayMigrationStrategy implements
FlywayMigrationStrategy {
--- End diff --
This is a nice solution to determining when to migrate databases. Nice work!
> Allow metadata DB to use other DBs besides H2
> ---------------------------------------------
>
> Key: NIFIREG-173
> URL: https://issues.apache.org/jira/browse/NIFIREG-173
> Project: NiFi Registry
> Issue Type: Improvement
> Affects Versions: 0.1.0
> Reporter: Bryan Bende
> Assignee: Bryan Bende
> Priority: Major
>
> Now that we have the Git provider for flow storage which can be used to push
> flows to a remote location, it would be nice to be able to leverage an
> external DB for the metadata database.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)