## Submitting issues If you have questions about how to install or use ownCloud, please direct these to the [mailing list][mailinglist] or our [forum][forum]. We are also available on [IRC][irc]. ### TL;DR * The [issue template can be found here][template] but be aware of the different repositories! See list below. ### Guidelines * Please search the existing issues first, it's likely that your issue was already reported or even fixed. - Go to one of the repositories, click "issues" and type any word in the top search/command bar. - You can also filter by appending e. g. "state:open" to the search string. - More info on [search syntax within github](https://help.github.com/articles/searching-issues) * This repository ([core](https://github.com/owncloud/core/issues)) is *only* for issues within the ownCloud core code. This also includes the apps: files, encryption, external storage, sharing, deleted files, versions, LDAP, and WebDAV Auth * The issues in other components should be reported in their respective repositories: - [Android client](https://github.com/owncloud/android/issues) - [iOS client](https://github.com/owncloud/ios-issues/issues) - [Desktop client](https://github.com/owncloud/mirall/issues) - Apps: - [Bookmarks](https://github.com/owncloud/bookmarks/issues) - [Calendar](https://github.com/owncloud/calendar/issues) - [Contacts](https://github.com/owncloud/contacts/issues) - [Documents](https://github.com/owncloud/documents/issues) - [Mail](https://github.com/owncloud/mail/issues) - [Media/Music](https://github.com/owncloud/media/issues) - [News](https://github.com/owncloud/news/issues) - [Notes](https://github.com/owncloud/notes/issues) - [Shorty](https://github.com/owncloud/shorty/issues) - [All other apps](https://github.com/owncloud/apps/issues) (e.g. Pictures, Tasks, ...) * Report the issue using our [template][template], it includes all the information we need to track down the issue. Help us to maximize the effort we can spend fixing issues and adding new features, by not reporting duplicate issues. [template]: https://raw.github.com/owncloud/core/master/issue_template.md [mailinglist]: https://mail.kde.org/mailman/listinfo/owncloud [forum]: http://forum.owncloud.org/ [irc]: http://webchat.freenode.net/?channels=owncloud&uio=d4 ## Contributing to Source Code Thanks for wanting to contribute source code to ownCloud. That's great! Before we're able to merge your code into the ownCloud core, you need to sign our [Contributor Agreement][agreement]. Please read the [Developer Manuals][devmanual] to learn how to create your first application or how to test the ownCloud code with PHPUnit. [agreement]: http://owncloud.org/about/contributor-agreement/ [devmanual]: http://owncloud.org/dev/ ## Translations Please submit translations via [Transifex][transifex]. [transifex]: https://www.transifex.com/projects/p/owncloud/ 'h' value='release/v1.23'/>
path: root/cmd/convert.go
blob: 6d4d99a255040a8ef4634d04b442be0e9b531a1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright 2019 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.

package cmd

import (
	"fmt"

	"code.gitea.io/gitea/models/db"
	"code.gitea.io/gitea/modules/log"
	"code.gitea.io/gitea/modules/setting"

	"github.com/urfave/cli"
)

// CmdConvert represents the available convert sub-command.
var CmdConvert = cli.Command{
	Name:        "convert",
	Usage:       "Convert the database",
	Description: "A command to convert an existing MySQL database from utf8 to utf8mb4",
	Action:      runConvert,
}

func runConvert(ctx *cli.Context) error {
	stdCtx, cancel := installSignals()
	defer cancel()

	if err := initDB(stdCtx); err != nil {
		return err
	}

	log.Info("AppPath: %s", setting.AppPath)
	log.Info("AppWorkPath: %s", setting.AppWorkPath)
	log.Info("Custom path: %s", setting.CustomPath)
	log.Info("Log path: %s", setting.LogRootPath)
	log.Info("Configuration file: %s", setting.CustomConf)

	if !setting.Database.UseMySQL {
		fmt.Println("This command can only be used with a MySQL database")
		return nil
	}

	if err := db.ConvertUtf8ToUtf8mb4(); err != nil {
		log.Fatal("Failed to convert database from utf8 to utf8mb4: %v", err)
		return err
	}

	fmt.Println("Converted successfully, please confirm your database's character set is now utf8mb4")

	return nil
}