keon94 commented on code in PR #3062:
URL: https://github.com/apache/incubator-devlake/pull/3062#discussion_r972506767


##########
models/migrationscripts/20220913_commitfile_add_length.go:
##########
@@ -0,0 +1,195 @@
+/*
+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 migrationscripts
+
+import (
+       "context"
+       "crypto/sha256"
+       "encoding/hex"
+       "reflect"
+       "strings"
+
+       "github.com/apache/incubator-devlake/errors"
+       "github.com/apache/incubator-devlake/models/migrationscripts/archived"
+       "github.com/apache/incubator-devlake/plugins/gitlab/api"

Review Comment:
   This is problematic. We shouldn't have a gitlab-specific under the 
models/migrationscripts. This is where the datasource-agnostic migrations take 
place.
   
   If I were to turn off the gitlab plugin, I get a panic because [this 
line](https://github.com/apache/incubator-devlake/blob/e43b9d70203759ddbe97205f29aeb63106c50d34/plugins/gitlab/api/init.go#L30),
 which sets the BasicRes global variable, will not run. Either BasicRes has to 
be set independently of gitlab (different package outside of plugins/), or this 
migration needs to be moved to the [gitlab migrations 
package](https://github.com/apache/incubator-devlake/tree/main/plugins/gitlab/models/migrationscripts)



##########
models/migrationscripts/20220913_commitfile_add_length.go:
##########
@@ -0,0 +1,195 @@
+/*
+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 migrationscripts
+
+import (
+       "context"
+       "crypto/sha256"
+       "encoding/hex"
+       "reflect"
+       "strings"
+
+       "github.com/apache/incubator-devlake/errors"
+       "github.com/apache/incubator-devlake/models/migrationscripts/archived"
+       "github.com/apache/incubator-devlake/plugins/gitlab/api"

Review Comment:
   This is problematic. We shouldn't have a gitlab-specific reference under the 
models/migrationscripts. This is where the datasource-agnostic migrations take 
place.
   
   If I were to turn off the gitlab plugin, I get a panic because [this 
line](https://github.com/apache/incubator-devlake/blob/e43b9d70203759ddbe97205f29aeb63106c50d34/plugins/gitlab/api/init.go#L30),
 which sets the BasicRes global variable, will not run. Either BasicRes has to 
be set independently of gitlab (different package outside of plugins/), or this 
migration needs to be moved to the [gitlab migrations 
package](https://github.com/apache/incubator-devlake/tree/main/plugins/gitlab/models/migrationscripts)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to