···295295 "licenseText": "ISC License\n\nCopyright (c) 2012-2016 Dave Collins \u003cdave@davec.name\u003e\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted, provided that the above\ncopyright notice and this permission notice appear in all copies.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\nWITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\nMERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\nANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\nWHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\nACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\nOR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n"
296296 },
297297 {
298298- "name": "github.com/denisenkom/go-mssqldb",
299299- "path": "github.com/denisenkom/go-mssqldb/LICENSE.txt",
300300- "licenseText": "Copyright (c) 2012 The Go Authors. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\n * Redistributions of source code must retain the above copyright\nnotice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above\ncopyright notice, this list of conditions and the following disclaimer\nin the documentation and/or other materials provided with the\ndistribution.\n * Neither the name of Google Inc. nor the names of its\ncontributors may be used to endorse or promote products derived from\nthis software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"
301301- },
302302- {
303298 "name": "github.com/dgryski/go-rendezvous",
304299 "path": "github.com/dgryski/go-rendezvous/LICENSE",
305300 "licenseText": "The MIT License (MIT)\n\nCopyright (c) 2017-2020 Damian Gryski \u003cdamian@gryski.com\u003e\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"
···503498 "name": "github.com/golang-jwt/jwt/v5",
504499 "path": "github.com/golang-jwt/jwt/v5/LICENSE",
505500 "licenseText": "Copyright (c) 2012 Dave Grijalva\nCopyright (c) 2021 golang-jwt maintainers\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n"
506506- },
507507- {
508508- "name": "github.com/golang-sql/civil",
509509- "path": "github.com/golang-sql/civil/LICENSE",
510510- "licenseText": "\n Apache License\n Version 2.0, January 2004\n http://www.apache.org/licenses/\n\n TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n 1. Definitions.\n\n \"License\" shall mean the terms and conditions for use, reproduction,\n and distribution as defined by Sections 1 through 9 of this document.\n\n \"Licensor\" shall mean the copyright owner or entity authorized by\n the copyright owner that is granting the License.\n\n \"Legal Entity\" shall mean the union of the acting entity and all\n other entities that control, are controlled by, or are under common\n control with that entity. For the purposes of this definition,\n \"control\" means (i) the power, direct or indirect, to cause the\n direction or management of such entity, whether by contract or\n otherwise, or (ii) ownership of fifty percent (50%) or more of the\n outstanding shares, or (iii) beneficial ownership of such entity.\n\n \"You\" (or \"Your\") shall mean an individual or Legal Entity\n exercising permissions granted by this License.\n\n \"Source\" form shall mean the preferred form for making modifications,\n including but not limited to software source code, documentation\n source, and configuration files.\n\n \"Object\" form shall mean any form resulting from mechanical\n transformation or translation of a Source form, including but\n not limited to compiled object code, generated documentation,\n and conversions to other media types.\n\n \"Work\" shall mean the work of authorship, whether in Source or\n Object form, made available under the License, as indicated by a\n copyright notice that is included in or attached to the work\n (an example is provided in the Appendix below).\n\n \"Derivative Works\" shall mean any work, whether in Source or Object\n form, that is based on (or derived from) the Work and for which the\n editorial revisions, annotations, elaborations, or other modifications\n represent, as a whole, an original work of authorship. For the purposes\n of this License, Derivative Works shall not include works that remain\n separable from, or merely link (or bind by name) to the interfaces of,\n the Work and Derivative Works thereof.\n\n \"Contribution\" shall mean any work of authorship, including\n the original version of the Work and any modifications or additions\n to that Work or Derivative Works thereof, that is intentionally\n submitted to Licensor for inclusion in the Work by the copyright owner\n or by an individual or Legal Entity authorized to submit on behalf of\n the copyright owner. For the purposes of this definition, \"submitted\"\n means any form of electronic, verbal, or written communication sent\n to the Licensor or its representatives, including but not limited to\n communication on electronic mailing lists, source code control systems,\n and issue tracking systems that are managed by, or on behalf of, the\n Licensor for the purpose of discussing and improving the Work, but\n excluding communication that is conspicuously marked or otherwise\n designated in writing by the copyright owner as \"Not a Contribution.\"\n\n \"Contributor\" shall mean Licensor and any individual or Legal Entity\n on behalf of whom a Contribution has been received by Licensor and\n subsequently incorporated within the Work.\n\n 2. Grant of Copyright License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n copyright license to reproduce, prepare Derivative Works of,\n publicly display, publicly perform, sublicense, and distribute the\n Work and such Derivative Works in Source or Object form.\n\n 3. Grant of Patent License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n (except as stated in this section) patent license to make, have made,\n use, offer to sell, sell, import, and otherwise transfer the Work,\n where such license applies only to those patent claims licensable\n by such Contributor that are necessarily infringed by their\n Contribution(s) alone or by combination of their Contribution(s)\n with the Work to which such Contribution(s) was submitted. If You\n institute patent litigation against any entity (including a\n cross-claim or counterclaim in a lawsuit) alleging that the Work\n or a Contribution incorporated within the Work constitutes direct\n or contributory patent infringement, then any patent licenses\n granted to You under this License for that Work shall terminate\n as of the date such litigation is filed.\n\n 4. Redistribution. You may reproduce and distribute copies of the\n Work or Derivative Works thereof in any medium, with or without\n modifications, and in Source or Object form, provided that You\n meet the following conditions:\n\n (a) You must give any other recipients of the Work or\n Derivative Works a copy of this License; and\n\n (b) You must cause any modified files to carry prominent notices\n stating that You changed the files; and\n\n (c) You must retain, in the Source form of any Derivative Works\n that You distribute, all copyright, patent, trademark, and\n attribution notices from the Source form of the Work,\n excluding those notices that do not pertain to any part of\n the Derivative Works; and\n\n (d) If the Work includes a \"NOTICE\" text file as part of its\n distribution, then any Derivative Works that You distribute must\n include a readable copy of the attribution notices contained\n within such NOTICE file, excluding those notices that do not\n pertain to any part of the Derivative Works, in at least one\n of the following places: within a NOTICE text file distributed\n as part of the Derivative Works; within the Source form or\n documentation, if provided along with the Derivative Works; or,\n within a display generated by the Derivative Works, if and\n wherever such third-party notices normally appear. The contents\n of the NOTICE file are for informational purposes only and\n do not modify the License. You may add Your own attribution\n notices within Derivative Works that You distribute, alongside\n or as an addendum to the NOTICE text from the Work, provided\n that such additional attribution notices cannot be construed\n as modifying the License.\n\n You may add Your own copyright statement to Your modifications and\n may provide additional or different license terms and conditions\n for use, reproduction, or distribution of Your modifications, or\n for any such Derivative Works as a whole, provided Your use,\n reproduction, and distribution of the Work otherwise complies with\n the conditions stated in this License.\n\n 5. Submission of Contributions. Unless You explicitly state otherwise,\n any Contribution intentionally submitted for inclusion in the Work\n by You to the Licensor shall be under the terms and conditions of\n this License, without any additional terms or conditions.\n Notwithstanding the above, nothing herein shall supersede or modify\n the terms of any separate license agreement you may have executed\n with Licensor regarding such Contributions.\n\n 6. Trademarks. This License does not grant permission to use the trade\n names, trademarks, service marks, or product names of the Licensor,\n except as required for reasonable and customary use in describing the\n origin of the Work and reproducing the content of the NOTICE file.\n\n 7. Disclaimer of Warranty. Unless required by applicable law or\n agreed to in writing, Licensor provides the Work (and each\n Contributor provides its Contributions) on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n implied, including, without limitation, any warranties or conditions\n of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n PARTICULAR PURPOSE. You are solely responsible for determining the\n appropriateness of using or redistributing the Work and assume any\n risks associated with Your exercise of permissions under this License.\n\n 8. Limitation of Liability. In no event and under no legal theory,\n whether in tort (including negligence), contract, or otherwise,\n unless required by applicable law (such as deliberate and grossly\n negligent acts) or agreed to in writing, shall any Contributor be\n liable to You for damages, including any direct, indirect, special,\n incidental, or consequential damages of any character arising as a\n result of this License or out of the use or inability to use the\n Work (including but not limited to damages for loss of goodwill,\n work stoppage, computer failure or malfunction, or any and all\n other commercial damages or losses), even if such Contributor\n has been advised of the possibility of such damages.\n\n 9. Accepting Warranty or Additional Liability. While redistributing\n the Work or Derivative Works thereof, You may choose to offer,\n and charge a fee for, acceptance of support, warranty, indemnity,\n or other liability obligations and/or rights consistent with this\n License. However, in accepting such obligations, You may act only\n on Your own behalf and on Your sole responsibility, not on behalf\n of any other Contributor, and only if You agree to indemnify,\n defend, and hold each Contributor harmless for any liability\n incurred by, or claims asserted against, such Contributor by reason\n of your accepting any such warranty or additional liability.\n\n END OF TERMS AND CONDITIONS\n\n APPENDIX: How to apply the Apache License to your work.\n\n To apply the Apache License to your work, attach the following\n boilerplate notice, with the fields enclosed by brackets \"[]\"\n replaced with your own identifying information. (Don't include\n the brackets!) The text should be enclosed in the appropriate\n comment syntax for the file format. We also recommend that a\n file or class name and description of purpose be included on the\n same \"printed page\" as the copyright notice for easier\n identification within third-party archives.\n\n Copyright [yyyy] [name of copyright owner]\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License."
511511- },
512512- {
513513- "name": "github.com/golang-sql/sqlexp",
514514- "path": "github.com/golang-sql/sqlexp/LICENSE",
515515- "licenseText": "Copyright (c) 2017 The Go Authors. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\n * Redistributions of source code must retain the above copyright\nnotice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above\ncopyright notice, this list of conditions and the following disclaimer\nin the documentation and/or other materials provided with the\ndistribution.\n * Neither the name of Google Inc. nor the names of its\ncontributors may be used to endorse or promote products derived from\nthis software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"
516501 },
517502 {
518503 "name": "github.com/golang/geo",
+4-11
cmd/doctor_convert.go
···1717var cmdDoctorConvert = &cli.Command{
1818 Name: "convert",
1919 Usage: "Convert the database",
2020- Description: "A command to convert an existing MySQL database from utf8 to utf8mb4 or MSSQL database from varchar to nvarchar",
2020+ Description: "A command to convert an existing MySQL database from utf8 to utf8mb4",
2121 Action: runDoctorConvert,
2222}
2323···3535 log.Info("Log path: %s", setting.Log.RootPath)
3636 log.Info("Configuration file: %s", setting.CustomConf)
37373838- switch {
3939- case setting.Database.Type.IsMySQL():
3838+ if setting.Database.Type.IsMySQL() {
4039 if err := db.ConvertDatabaseTable(); err != nil {
4140 log.Fatal("Failed to convert database & table: %v", err)
4241 return err
4342 }
4443 fmt.Println("Converted successfully, please confirm your database's character set is now utf8mb4")
4545- case setting.Database.Type.IsMSSQL():
4646- if err := db.ConvertVarcharToNVarchar(); err != nil {
4747- log.Fatal("Failed to convert database from varchar to nvarchar: %v", err)
4848- return err
4949- }
5050- fmt.Println("Converted successfully, please confirm your database's all columns character is NVARCHAR now")
5151- default:
5252- fmt.Println("This command can only be used with a MySQL or MSSQL database")
4444+ } else {
4545+ fmt.Println("This command can only be used with a MySQL database")
5346 }
54475548 return nil
···3939 // Group by 15 minute intervals which will allow the client to accurately shift the timestamp to their timezone.
4040 // The interval is based on the fact that there are timezones such as UTC +5:30 and UTC +12:45.
4141 groupBy := "created_unix / 900 * 900"
4242- groupByName := "timestamp" // We need this extra case because mssql doesn't allow grouping by alias
4343- switch {
4444- case setting.Database.Type.IsMySQL():
4242+ if setting.Database.Type.IsMySQL() {
4543 groupBy = "created_unix DIV 900 * 900"
4646- case setting.Database.Type.IsMSSQL():
4747- groupByName = groupBy
4844 }
49455046 cond, err := activityQueryCondition(ctx, GetFeedsOptions{
···6763 Table("action").
6864 Where(cond).
6965 And("created_unix > ?", timeutil.TimeStampNow()-31536000).
7070- GroupBy(groupByName).
6666+ GroupBy("timestamp").
7167 OrderBy("timestamp").
7268 Find(&hdata)
7369}
+1-32
models/db/collation.go
···4141 return ret, nil
4242}
43434444-func findAvailableCollationsMSSQL(x *xorm.Engine) (ret container.Set[string], err error) {
4545- var res []struct {
4646- Name string
4747- }
4848- if err = x.SQL("SELECT * FROM sys.fn_helpcollations() WHERE name LIKE '%[_]CS[_]AS%'").Find(&res); err != nil {
4949- return nil, err
5050- }
5151- ret = make(container.Set[string], len(res))
5252- for _, r := range res {
5353- ret.Add(r.Name)
5454- }
5555- return ret, nil
5656-}
5757-5844func CheckCollations(x *xorm.Engine) (*CheckCollationsResult, error) {
5945 dbTables, err := x.DBMetas()
6046 if err != nil {
···8470 // At the moment, it's safe to ignore the database difference, just trim the prefix and compare. It could be fixed easily if there is any problem in the future.
8571 return a == b || strings.TrimPrefix(a, "utf8mb4_") == strings.TrimPrefix(b, "utf8mb4_")
8672 }
8787- } else if x.Dialect().URI().DBType == schemas.MSSQL {
8888- if _, err = x.SQL("SELECT DATABASEPROPERTYEX(DB_NAME(), 'Collation')").Get(&res.DatabaseCollation); err != nil {
8989- return nil, err
9090- }
9191- res.IsCollationCaseSensitive = func(s string) bool {
9292- return strings.HasSuffix(s, "_CS_AS")
9393- }
9494- candidateCollations = []string{"Latin1_General_CS_AS"}
9595- res.AvailableCollation, err = findAvailableCollationsMSSQL(x)
9696- if err != nil {
9797- return nil, err
9898- }
9973 } else {
10074 return nil, nil
10175 }
···146120 if x.Dialect().URI().DBType == schemas.MYSQL {
147121 _, err := x.Exec("ALTER DATABASE CHARACTER SET utf8mb4 COLLATE " + collation)
148122 return err
149149- } else if x.Dialect().URI().DBType == schemas.MSSQL {
150150- // TODO: MSSQL has many limitations on changing database collation, it could fail in many cases.
151151- _, err := x.Exec("ALTER DATABASE CURRENT COLLATE " + collation)
152152- return err
153123 }
154124 return errors.New("unsupported database type")
155125}
···165135 }
166136167137 // try to alter database collation to expected if the database is empty, it might fail in some cases (and it isn't necessary to succeed)
168168- // at the moment, there is no "altering" solution for MSSQL, site admin should manually change the database collation
138138+ // at the moment.
169139 if !r.CollationEquals(r.DatabaseCollation, r.ExpectedCollation) && r.ExistingTableNumber == 0 {
170140 if err = alterDatabaseCollation(x, r.ExpectedCollation); err != nil {
171141 log.Error("Failed to change database collation to %q: %v", r.ExpectedCollation, err)
172142 } else {
173173- _, _ = x.Exec("SELECT 1") // after "altering", MSSQL's session becomes invalid, so make a simple query to "refresh" the session
174143 if r, err = CheckCollations(x); err != nil {
175144 log.Error("Failed to check database collation again after altering: %v", err) // impossible case
176145 return
···4747 return nil
4848}
49495050-// ConvertVarcharToNVarchar converts database and tables from varchar to nvarchar if it's mssql
5151-func ConvertVarcharToNVarchar() error {
5252- if x.Dialect().URI().DBType != schemas.MSSQL {
5353- return nil
5454- }
5555-5656- sess := x.NewSession()
5757- defer sess.Close()
5858- res, err := sess.QuerySliceString(`SELECT 'ALTER TABLE ' + OBJECT_NAME(SC.object_id) + ' MODIFY SC.name NVARCHAR(' + CONVERT(VARCHAR(5),SC.max_length) + ')'
5959-FROM SYS.columns SC
6060-JOIN SYS.types ST
6161-ON SC.system_type_id = ST.system_type_id
6262-AND SC.user_type_id = ST.user_type_id
6363-WHERE ST.name ='varchar'`)
6464- if err != nil {
6565- return err
6666- }
6767- for _, row := range res {
6868- if len(row) == 1 {
6969- if _, err = sess.Exec(row[0]); err != nil {
7070- return err
7171- }
7272- }
7373- }
7474- return err
7575-}
7676-7750// Cell2Int64 converts a xorm.Cell type to int64,
7851// and handles possible irregular cases.
7952func Cell2Int64(val xorm.Cell) int64 {
+3-6
models/db/engine.go
···2222 "xorm.io/xorm/names"
2323 "xorm.io/xorm/schemas"
24242525- _ "github.com/denisenkom/go-mssqldb" // Needed for the MSSQL driver
2626- _ "github.com/go-sql-driver/mysql" // Needed for the MySQL driver
2727- _ "github.com/lib/pq" // Needed for the Postgresql driver
2525+ _ "github.com/go-sql-driver/mysql" // Needed for the MySQL driver
2626+ _ "github.com/lib/pq" // Needed for the Postgresql driver
2827)
29283029var (
···114113 if err != nil {
115114 return nil, err
116115 }
117117- if setting.Database.Type == "mysql" {
116116+ if setting.Database.Type.IsMySQL() {
118117 engine.Dialect().SetParams(map[string]string{"rowFormat": "DYNAMIC"})
119119- } else if setting.Database.Type == "mssql" {
120120- engine.Dialect().SetParams(map[string]string{"DEFAULT_VARCHAR": "nvarchar"})
121118 }
122119 engine.SetSchema(setting.Database.Schema)
123120 return engine, nil
-29
models/db/index.go
···8989 return idx, nil
9090}
91919292-func mssqlGetNextResourceIndex(ctx context.Context, tableName string, groupID int64) (int64, error) {
9393- if _, err := GetEngine(ctx).Exec(fmt.Sprintf(`
9494-MERGE INTO %s WITH (HOLDLOCK) AS target
9595-USING (SELECT %d AS group_id) AS source
9696-(group_id)
9797-ON target.group_id = source.group_id
9898-WHEN MATCHED
9999- THEN UPDATE
100100- SET max_index = max_index + 1
101101-WHEN NOT MATCHED
102102- THEN INSERT (group_id, max_index)
103103- VALUES (%d, 1);
104104-`, tableName, groupID, groupID)); err != nil {
105105- return 0, err
106106- }
107107-108108- var idx int64
109109- _, err := GetEngine(ctx).SQL(fmt.Sprintf("SELECT max_index FROM %s WHERE group_id = ?", tableName), groupID).Get(&idx)
110110- if err != nil {
111111- return 0, err
112112- }
113113- if idx == 0 {
114114- return 0, errors.New("cannot get the correct index")
115115- }
116116- return idx, nil
117117-}
118118-11992// GetNextResourceIndex generates a resource index, it must run in the same transaction where the resource is created
12093func GetNextResourceIndex(ctx context.Context, tableName string, groupID int64) (int64, error) {
12194 switch {
···12396 return postgresGetNextResourceIndex(ctx, tableName, groupID)
12497 case setting.Database.Type.IsMySQL():
12598 return mysqlGetNextResourceIndex(ctx, tableName, groupID)
126126- case setting.Database.Type.IsMSSQL():
127127- return mssqlGetNextResourceIndex(ctx, tableName, groupID)
12899 }
129100130101 e := GetEngine(ctx)
+1-1
models/git/branch.go
···103103type Branch struct {
104104 ID int64
105105 RepoID int64 `xorm:"UNIQUE(s)"`
106106- Name string `xorm:"UNIQUE(s) NOT NULL"` // git's ref-name is case-sensitive internally, however, in some databases (mssql, mysql, by default), it's case-insensitive at the moment
106106+ Name string `xorm:"UNIQUE(s) NOT NULL"` // git's ref-name is case-sensitive internally, however, in some databases (mysql, by default), it's case-insensitive at the moment
107107 CommitID string
108108 CommitMessage string `xorm:"TEXT"` // it only stores the message summary (the first line)
109109 PusherID int64
-30
models/git/commit_status.go
···8484 return idx, nil
8585}
86868787-func mssqlGetCommitStatusIndex(ctx context.Context, repoID int64, sha string) (int64, error) {
8888- if _, err := db.GetEngine(ctx).Exec(`
8989-MERGE INTO commit_status_index WITH (HOLDLOCK) AS target
9090-USING (SELECT ? AS repo_id, ? AS sha) AS source
9191-(repo_id, sha)
9292-ON target.repo_id = source.repo_id AND target.sha = source.sha
9393-WHEN MATCHED
9494- THEN UPDATE
9595- SET max_index = max_index + 1
9696-WHEN NOT MATCHED
9797- THEN INSERT (repo_id, sha, max_index)
9898- VALUES (?, ?, 1);
9999-`, repoID, sha, repoID, sha); err != nil {
100100- return 0, err
101101- }
102102-103103- var idx int64
104104- _, err := db.GetEngine(ctx).SQL("SELECT max_index FROM `commit_status_index` WHERE repo_id = ? AND sha = ?",
105105- repoID, sha).Get(&idx)
106106- if err != nil {
107107- return 0, err
108108- }
109109- if idx == 0 {
110110- return 0, errors.New("cannot get the correct index")
111111- }
112112- return idx, nil
113113-}
114114-11587// GetNextCommitStatusIndex retried 3 times to generate a resource index
11688func GetNextCommitStatusIndex(ctx context.Context, repoID int64, sha string) (int64, error) {
11789 _, err := git.NewIDFromString(sha)
···12496 return postgresGetCommitStatusIndex(ctx, repoID, sha)
12597 case setting.Database.Type.IsMySQL():
12698 return mysqlGetCommitStatusIndex(ctx, repoID, sha)
127127- case setting.Database.Type.IsMSSQL():
128128- return mssqlGetCommitStatusIndex(ctx, repoID, sha)
12999 }
130100131101 e := db.GetEngine(ctx)
-91
models/migrations/base/db.go
···8989 hasID = hasID || (column.IsPrimaryKey && column.IsAutoIncrement)
9090 }
91919292- if hasID && setting.Database.Type.IsMSSQL() {
9393- if _, err := sess.Exec(fmt.Sprintf("SET IDENTITY_INSERT `%s` ON", tempTableName)); err != nil {
9494- log.Error("Unable to set identity insert for table %s. Error: %v", tempTableName, err)
9595- return err
9696- }
9797- }
9898-9992 sqlStringBuilder := &strings.Builder{}
10093 _, _ = sqlStringBuilder.WriteString("INSERT INTO `")
10194 _, _ = sqlStringBuilder.WriteString(tempTableName)
···141134 if _, err := sess.Exec(sqlStringBuilder.String()); err != nil {
142135 log.Error("Unable to set copy data in to temp table %s. Error: %v", tempTableName, err)
143136 return err
144144- }
145145-146146- if hasID && setting.Database.Type.IsMSSQL() {
147147- if _, err := sess.Exec(fmt.Sprintf("SET IDENTITY_INSERT `%s` OFF", tempTableName)); err != nil {
148148- log.Error("Unable to switch off identity insert for table %s. Error: %v", tempTableName, err)
149149- return err
150150- }
151137 }
152138153139 switch {
···296282297283 }
298284299299- case setting.Database.Type.IsMSSQL():
300300- // MSSQL will drop all the constraints on the old table
301301- if _, err := sess.Exec(fmt.Sprintf("DROP TABLE `%s`", tableName)); err != nil {
302302- log.Error("Unable to drop old table %s. Error: %v", tableName, err)
303303- return err
304304- }
305305-306306- // MSSQL sp_rename will move all the constraints from the temporary table to the new table
307307- if _, err := sess.Exec(fmt.Sprintf("sp_rename `%s`,`%s`", tempTableName, tableName)); err != nil {
308308- log.Error("Unable to rename %s to %s. Error: %v", tempTableName, tableName, err)
309309- return err
310310- }
311311-312285 default:
313286 log.Fatal("Unrecognized DB")
314287 }
···444417 if _, err := sess.Exec(fmt.Sprintf("ALTER TABLE `%s` %s", tableName, cols)); err != nil {
445418 return fmt.Errorf("Drop table `%s` columns %v: %v", tableName, columnNames, err)
446419 }
447447- case setting.Database.Type.IsMSSQL():
448448- cols := ""
449449- for _, col := range columnNames {
450450- if cols != "" {
451451- cols += ", "
452452- }
453453- cols += "`" + strings.ToLower(col) + "`"
454454- }
455455- sql := fmt.Sprintf("SELECT Name FROM sys.default_constraints WHERE parent_object_id = OBJECT_ID('%[1]s') AND parent_column_id IN (SELECT column_id FROM sys.columns WHERE LOWER(name) IN (%[2]s) AND object_id = OBJECT_ID('%[1]s'))",
456456- tableName, strings.ReplaceAll(cols, "`", "'"))
457457- constraints := make([]string, 0)
458458- if err := sess.SQL(sql).Find(&constraints); err != nil {
459459- return fmt.Errorf("Find constraints: %v", err)
460460- }
461461- for _, constraint := range constraints {
462462- if _, err := sess.Exec(fmt.Sprintf("ALTER TABLE `%s` DROP CONSTRAINT `%s`", tableName, constraint)); err != nil {
463463- return fmt.Errorf("Drop table `%s` default constraint `%s`: %v", tableName, constraint, err)
464464- }
465465- }
466466- sql = fmt.Sprintf("SELECT DISTINCT Name FROM sys.indexes INNER JOIN sys.index_columns ON indexes.index_id = index_columns.index_id AND indexes.object_id = index_columns.object_id WHERE indexes.object_id = OBJECT_ID('%[1]s') AND index_columns.column_id IN (SELECT column_id FROM sys.columns WHERE LOWER(name) IN (%[2]s) AND object_id = OBJECT_ID('%[1]s'))",
467467- tableName, strings.ReplaceAll(cols, "`", "'"))
468468- constraints = make([]string, 0)
469469- if err := sess.SQL(sql).Find(&constraints); err != nil {
470470- return fmt.Errorf("Find constraints: %v", err)
471471- }
472472- for _, constraint := range constraints {
473473- if _, err := sess.Exec(fmt.Sprintf("DROP INDEX `%[2]s` ON `%[1]s`", tableName, constraint)); err != nil {
474474- return fmt.Errorf("Drop index `%[2]s` on `%[1]s`: %v", tableName, constraint, err)
475475- }
476476- }
477477-478478- if _, err := sess.Exec(fmt.Sprintf("ALTER TABLE `%s` DROP COLUMN %s", tableName, cols)); err != nil {
479479- return fmt.Errorf("Drop table `%s` columns %v: %v", tableName, columnNames, err)
480480- }
481420 default:
482421 log.Fatal("Unrecognized DB")
483422 }
···489428func ModifyColumn(x *xorm.Engine, tableName string, col *schemas.Column) error {
490429 var indexes map[string]*schemas.Index
491430 var err error
492492- // MSSQL have to remove index at first, otherwise alter column will fail
493493- // ref. https://sqlzealots.com/2018/05/09/error-message-the-index-is-dependent-on-column-alter-table-alter-column-failed-because-one-or-more-objects-access-this-column/
494494- if x.Dialect().URI().DBType == schemas.MSSQL {
495495- indexes, err = x.Dialect().GetIndexes(x.DB(), context.Background(), tableName)
496496- if err != nil {
497497- return err
498498- }
499499-500500- for _, index := range indexes {
501501- _, err = x.Exec(x.Dialect().DropIndexSQL(tableName, index))
502502- if err != nil {
503503- return err
504504- }
505505- }
506506- }
507431508432 defer func() {
509433 for _, index := range indexes {
···611535 return err
612536 }
613537 return nil
614614- }
615615- case setting.Database.Type.IsMSSQL():
616616- host, port := setting.ParseMSSQLHostPort(setting.Database.Host)
617617- db, err := sql.Open("mssql", fmt.Sprintf("server=%s; port=%s; database=%s; user id=%s; password=%s;",
618618- host, port, "master", setting.Database.User, setting.Database.Passwd))
619619- if err != nil {
620620- return err
621621- }
622622- defer db.Close()
623623-624624- if _, err = db.Exec(fmt.Sprintf("DROP DATABASE IF EXISTS [%s]", setting.Database.Name)); err != nil {
625625- return err
626626- }
627627- if _, err = db.Exec(fmt.Sprintf("CREATE DATABASE [%s]", setting.Database.Name)); err != nil {
628628- return err
629538 }
630539 }
631540
-3
models/migrations/v1_11/v110.go
···1616 case schemas.ORACLE:
1717 _, err := x.Exec("ALTER TABLE review MODIFY content TEXT")
1818 return err
1919- case schemas.MSSQL:
2020- _, err := x.Exec("ALTER TABLE review ALTER COLUMN content TEXT")
2121- return err
2219 case schemas.POSTGRES:
2320 _, err := x.Exec("ALTER TABLE review ALTER COLUMN content TYPE TEXT")
2421 return err
+2-5
models/migrations/v1_12/v139.go
···1212func PrependRefsHeadsToIssueRefs(x *xorm.Engine) error {
1313 var query string
14141515- switch {
1616- case setting.Database.Type.IsMSSQL():
1717- query = "UPDATE `issue` SET `ref` = 'refs/heads/' + `ref` WHERE `ref` IS NOT NULL AND `ref` <> '' AND `ref` NOT LIKE 'refs/%'"
1818- case setting.Database.Type.IsMySQL():
1515+ if setting.Database.Type.IsMySQL() {
1916 query = "UPDATE `issue` SET `ref` = CONCAT('refs/heads/', `ref`) WHERE `ref` IS NOT NULL AND `ref` <> '' AND `ref` NOT LIKE 'refs/%';"
2020- default:
1717+ } else {
2118 query = "UPDATE `issue` SET `ref` = 'refs/heads/' || `ref` WHERE `ref` IS NOT NULL AND `ref` <> '' AND `ref` NOT LIKE 'refs/%'"
2219 }
2320
-26
models/migrations/v1_13/v145.go
···4545 if _, err := sess.Exec(fmt.Sprintf("ALTER TABLE language_stat MODIFY COLUMN language %s", sqlType)); err != nil {
4646 return err
4747 }
4848- case setting.Database.Type.IsMSSQL():
4949- // Yet again MSSQL just has to be awkward.
5050- // Here we have to drop the constraints first and then rebuild them
5151- constraints := make([]string, 0)
5252- if err := sess.SQL(`SELECT i.name AS Name
5353- FROM sys.indexes i INNER JOIN sys.index_columns ic
5454- ON i.index_id = ic.index_id AND i.object_id = ic.object_id
5555- INNER JOIN sys.tables AS t
5656- ON t.object_id = i.object_id
5757- INNER JOIN sys.columns c
5858- ON t.object_id = c.object_id AND ic.column_id = c.column_id
5959- WHERE t.name = 'language_stat' AND c.name = 'language'`).Find(&constraints); err != nil {
6060- return fmt.Errorf("Find constraints: %w", err)
6161- }
6262- for _, constraint := range constraints {
6363- if _, err := sess.Exec(fmt.Sprintf("DROP INDEX [%s] ON `language_stat`", constraint)); err != nil {
6464- return fmt.Errorf("Drop table `language_stat` constraint `%s`: %w", constraint, err)
6565- }
6666- }
6767- if _, err := sess.Exec(fmt.Sprintf("ALTER TABLE language_stat ALTER COLUMN language %s", sqlType)); err != nil {
6868- return err
6969- }
7070- // Finally restore the constraint
7171- if err := sess.CreateUniques(new(LanguageStat)); err != nil {
7272- return err
7373- }
7448 case setting.Database.Type.IsPostgreSQL():
7549 if _, err := sess.Exec(fmt.Sprintf("ALTER TABLE language_stat ALTER COLUMN language TYPE %s", sqlType)); err != nil {
7650 return err
-30
models/migrations/v1_13/v151.go
···2323 case setting.Database.Type.IsPostgreSQL():
2424 _, err := x.Exec("ALTER TABLE `user` ALTER COLUMN passwd_hash_algo SET DEFAULT 'argon2';")
2525 return err
2626- case setting.Database.Type.IsMSSQL():
2727- // need to find the constraint and drop it, then recreate it.
2828- sess := x.NewSession()
2929- defer sess.Close()
3030- if err := sess.Begin(); err != nil {
3131- return err
3232- }
3333- res, err := sess.QueryString("SELECT [name] FROM sys.default_constraints WHERE parent_object_id=OBJECT_ID(?) AND COL_NAME(parent_object_id, parent_column_id)=?;", "user", "passwd_hash_algo")
3434- if err != nil {
3535- return err
3636- }
3737- if len(res) > 0 {
3838- constraintName := res[0]["name"]
3939- log.Error("Results of select constraint: %s", constraintName)
4040- _, err := sess.Exec("ALTER TABLE [user] DROP CONSTRAINT " + constraintName)
4141- if err != nil {
4242- return err
4343- }
4444- _, err = sess.Exec("ALTER TABLE [user] ADD CONSTRAINT " + constraintName + " DEFAULT 'argon2' FOR passwd_hash_algo")
4545- if err != nil {
4646- return err
4747- }
4848- } else {
4949- _, err := sess.Exec("ALTER TABLE [user] ADD DEFAULT('argon2') FOR passwd_hash_algo")
5050- if err != nil {
5151- return err
5252- }
5353- }
5454- return sess.Commit()
5555-5626 case setting.Database.Type.IsSQLite3():
5727 // drop through
5828 default:
-10
models/migrations/v1_14/v158.go
···6262 return err
6363 }
64646565- if setting.Database.Type.IsMSSQL() {
6666- if _, err := sess.Exec(sqlSelect + " INTO #temp_comments" + sqlTail); err != nil {
6767- log.Error("unable to create temporary table")
6868- return err
6969- }
7070- }
7171-7265 comments := make([]*Comment, 0, batchSize)
73667467 switch {
···7871 fallthrough
7972 case setting.Database.Type.IsSQLite3():
8073 sqlCmd = sqlSelect + sqlTail + " LIMIT " + strconv.Itoa(batchSize) + " OFFSET " + strconv.Itoa(start)
8181- case setting.Database.Type.IsMSSQL():
8282- sqlCmd = "SELECT TOP " + strconv.Itoa(batchSize) + " * FROM #temp_comments WHERE " +
8383- "(id NOT IN ( SELECT TOP " + strconv.Itoa(start) + " id FROM #temp_comments ORDER BY id )) ORDER BY id"
8474 default:
8575 return fmt.Errorf("Unsupported database type")
8676 }
+2-14
models/migrations/v1_14/v165.go
···3232 return err
3333 }
34343535- var hookTaskTrimSQL string
3636- if dbType == schemas.MSSQL {
3737- hookTaskTrimSQL = "UPDATE hook_task SET typ = RTRIM(LTRIM(typ))"
3838- } else {
3939- hookTaskTrimSQL = "UPDATE hook_task SET typ = TRIM(typ)"
4040- }
4141- if _, err := x.Exec(hookTaskTrimSQL); err != nil {
3535+ if _, err := x.Exec("UPDATE hook_task SET typ = TRIM(typ)"); err != nil {
4236 return err
4337 }
4438···5852 return err
5953 }
60546161- var webhookTrimSQL string
6262- if dbType == schemas.MSSQL {
6363- webhookTrimSQL = "UPDATE webhook SET type = RTRIM(LTRIM(type))"
6464- } else {
6565- webhookTrimSQL = "UPDATE webhook SET type = TRIM(type)"
6666- }
6767- _, err := x.Exec(webhookTrimSQL)
5555+ _, err := x.Exec("UPDATE webhook SET type = TRIM(type)")
6856 return err
6957}
···44package v1_22 //nolint
5566import (
77- "fmt"
88-97 "xorm.io/xorm"
1010- "xorm.io/xorm/schemas"
118)
1291310func AddCombinedIndexToIssueUser(x *xorm.Engine) error {
···2320 return err
2421 }
2522 for _, issueUser := range duplicatedIssueUsers {
2626- if x.Dialect().URI().DBType == schemas.MSSQL {
2727- if _, err := x.Exec(fmt.Sprintf("delete from issue_user where id in (SELECT top %d id FROM issue_user WHERE issue_id = ? and uid = ?)", issueUser.Cnt-1), issueUser.IssueID, issueUser.UID); err != nil {
2828- return err
2929- }
3030- } else {
3131- var ids []int64
3232- if err := x.SQL("SELECT id FROM issue_user WHERE issue_id = ? and uid = ? limit ?", issueUser.IssueID, issueUser.UID, issueUser.Cnt-1).Find(&ids); err != nil {
3333- return err
3434- }
3535- if _, err := x.Table("issue_user").In("id", ids).Delete(); err != nil {
3636- return err
3737- }
2323+ var ids []int64
2424+ if err := x.SQL("SELECT id FROM issue_user WHERE issue_id = ? and uid = ? limit ?", issueUser.IssueID, issueUser.UID, issueUser.Cnt-1).Find(&ids); err != nil {
2525+ return err
2626+ }
2727+ if _, err := x.Table("issue_user").In("id", ids).Delete(); err != nil {
2828+ return err
3829 }
3930 }
4031
-32
models/migrations/v1_22/v286.go
···33package v1_22 //nolint
4455import (
66- "errors"
76 "fmt"
8798 "code.gitea.io/gitea/modules/log"
···3332 }
34333534 if !setting.Database.Type.IsSQLite3() {
3636- if setting.Database.Type.IsMSSQL() {
3737- // drop indexes that need to be re-created afterwards
3838- droppedIndexes := []string{
3939- "DROP INDEX IF EXISTS [IDX_commit_status_context_hash] ON [commit_status]",
4040- "DROP INDEX IF EXISTS [UQE_review_state_pull_commit_user] ON [review_state]",
4141- "DROP INDEX IF EXISTS [UQE_repo_archiver_s] ON [repo_archiver]",
4242- }
4343- for _, s := range droppedIndexes {
4444- _, err := db.Exec(s)
4545- if err != nil {
4646- return errors.New(s + " " + err.Error())
4747- }
4848- }
4949- }
5050-5135 for _, alts := range alteredTables {
5236 var err error
5337 if setting.Database.Type.IsMySQL() {
5438 _, err = db.Exec(fmt.Sprintf("ALTER TABLE `%s` MODIFY COLUMN `%s` VARCHAR(64)", alts[0], alts[1]))
5555- } else if setting.Database.Type.IsMSSQL() {
5656- _, err = db.Exec(fmt.Sprintf("ALTER TABLE [%s] ALTER COLUMN [%s] VARCHAR(64)", alts[0], alts[1]))
5739 } else {
5840 _, err = db.Exec(fmt.Sprintf("ALTER TABLE `%s` ALTER COLUMN `%s` TYPE VARCHAR(64)", alts[0], alts[1]))
5941 }
6042 if err != nil {
6143 return fmt.Errorf("alter column '%s' of table '%s' failed: %w", alts[1], alts[0], err)
6262- }
6363- }
6464-6565- if setting.Database.Type.IsMSSQL() {
6666- recreateIndexes := []string{
6767- "CREATE INDEX IDX_commit_status_context_hash ON commit_status(context_hash)",
6868- "CREATE UNIQUE INDEX UQE_review_state_pull_commit_user ON review_state(user_id, pull_id, commit_sha)",
6969- "CREATE UNIQUE INDEX UQE_repo_archiver_s ON repo_archiver(repo_id, type, commit_id)",
7070- }
7171- for _, s := range recreateIndexes {
7272- _, err := db.Exec(s)
7373- if err != nil {
7474- return errors.New(s + " " + err.Error())
7575- }
7644 }
7745 }
7846 }
-2
models/migrations/v1_8/v81.go
···1818 _, err = x.Exec("ALTER TABLE `u2f_registration` MODIFY `counter` BIGINT")
1919 case schemas.POSTGRES:
2020 _, err = x.Exec("ALTER TABLE `u2f_registration` ALTER COLUMN `counter` SET DATA TYPE bigint")
2121- case schemas.MSSQL:
2222- _, err = x.Exec("ALTER TABLE `u2f_registration` ALTER COLUMN `counter` BIGINT")
2321 }
24222523 if err != nil {
-2
models/unittest/fixtures.go
···6060 dialect = "postgres"
6161 case schemas.MYSQL:
6262 dialect = "mysql"
6363- case schemas.MSSQL:
6464- dialect = "mssql"
6563 case schemas.SQLITE:
6664 dialect = "sqlite3"
6765 default:
+2-31
modules/setting/database.go
···16161717var (
1818 // SupportedDatabaseTypes includes all XORM supported databases type, sqlite3 maybe added by `database_sqlite3.go`
1919- SupportedDatabaseTypes = []string{"mysql", "postgres", "mssql"}
1919+ SupportedDatabaseTypes = []string{"mysql", "postgres"}
2020 // DatabaseTypeNames contains the friendly names for all database types
2121- DatabaseTypeNames = map[string]string{"mysql": "MySQL", "postgres": "PostgreSQL", "mssql": "MSSQL", "sqlite3": "SQLite3"}
2121+ DatabaseTypeNames = map[string]string{"mysql": "MySQL", "postgres": "PostgreSQL", "sqlite3": "SQLite3"}
22222323 // EnableSQLite3 use SQLite3, set by build flag
2424 EnableSQLite3 bool
···120120 Database.User, Database.Passwd, connType, Database.Host, Database.Name, paramSep, tls)
121121 case "postgres":
122122 connStr = getPostgreSQLConnectionString(Database.Host, Database.User, Database.Passwd, Database.Name, Database.SSLMode)
123123- case "mssql":
124124- host, port := ParseMSSQLHostPort(Database.Host)
125125- connStr = fmt.Sprintf("server=%s; port=%s; database=%s; user id=%s; password=%s;", host, port, Database.Name, Database.User, Database.Passwd)
126123 case "sqlite3":
127124 if !EnableSQLite3 {
128125 return "", errors.New("this Gitea binary was not built with SQLite3 support")
···188185 return connURL.String()
189186}
190187191191-// ParseMSSQLHostPort splits the host into host and port
192192-func ParseMSSQLHostPort(info string) (string, string) {
193193- // the default port "0" might be related to MSSQL's dynamic port, maybe it should be double-confirmed in the future
194194- host, port := "127.0.0.1", "0"
195195- if strings.Contains(info, ":") {
196196- host = strings.Split(info, ":")[0]
197197- port = strings.Split(info, ":")[1]
198198- } else if strings.Contains(info, ",") {
199199- host = strings.Split(info, ",")[0]
200200- port = strings.TrimSpace(strings.Split(info, ",")[1])
201201- } else if len(info) > 0 {
202202- host = info
203203- }
204204- if host == "" {
205205- host = "127.0.0.1"
206206- }
207207- if port == "" {
208208- port = "0"
209209- }
210210- return host, port
211211-}
212212-213188type DatabaseType string
214189215190func (t DatabaseType) String() string {
···222197223198func (t DatabaseType) IsMySQL() bool {
224199 return t == "mysql"
225225-}
226226-227227-func (t DatabaseType) IsMSSQL() bool {
228228- return t == "mssql"
229200}
230201231202func (t DatabaseType) IsPostgreSQL() bool {
+1-2
options/locale/locale_ar.ini
···137137db_schema = مخطط
138138reinstall_error = أنت تحاول التثبيت في قاعدة بيانات فورجيو موجودة
139139sqlite_helper = مسار المِلَفّ لقاعدة بيانات SQLite3.<br>أدخل المسار المطلق إذا شغلت فورجيو كخدمة.
140140-require_db_desc = فورجيو يحتاج MySQL أو PostgreSQL أو MSSQL أو SQLite3 أو TiDB.
140140+require_db_desc = فورجيو يحتاج MySQL أو PostgreSQL أو SQLite3 أو TiDB.
141141password = كلمة المرور
142142host = المضيف
143143docker_helper = إذا كنت تستخدم فورجيو داخل دوكر، يرجي قراءة <a target="_blank" rel="noopener noreferrer" href="%s">المستندات</a> قبل تغيير أي إعدادات.
···15471547dashboard.sync_repo_tags = زامن الوسوم من بيانات جِت إلى قاعدة البيانات
15481548self_check = فحص ذاتي
15491549self_check.database_collation_case_insensitive = تستخدم قاعدة البيانات تجميع %s ، وهو تجميع غير حساس. على الرغم من أن فورجيو يمكن أن يعمل معها قد تكون هناك حالات نادرة لا تعمل كما هو متوقع.
15501550-self_check.database_fix_mssql = بالنسبة لمستخدمي الـإم إس سيكول، يمكنك إصلاح المشكلة بتعديل السيكول يدوياً فقط في الوقت الراهن.
15511550monitor.process.cancel_desc = قد يسبب إلغاء العملية فقدانًا للبيانات
15521551monitor.queue.type = النوع
15531552monitor.process.cancel_notices = أتريد إلغاء: <strong>%s</strong>؟
···219219install=Instalace
220220title=Počáteční konfigurace
221221docker_helper=Pokud spouštíte Forgejo v Dockeru, přečtěte si <a target="_blank" rel="noopener noreferrer" href="%s">dokumentaci</a>, než budete měnit jakákoliv nastavení.
222222-require_db_desc=Forgejo vyžaduje MySQL, PostgreSQL, MSSQL, SQLite3 nebo TiDB (protokol MySQL).
222222+require_db_desc=Forgejo vyžaduje MySQL, PostgreSQL, SQLite3 nebo TiDB (protokol MySQL).
223223db_title=Nastavení databáze
224224db_type=Typ databáze
225225host=Hostitel
···33963396dashboard.sync_tag.started = Synchronizace značek spuštěna
33973397dashboard.rebuild_issue_indexer = Přestavit indexer vydání
33983398self_check.database_collation_case_insensitive = Databáze používá collation %s. Jedná se o intenzivní collation. Ačkoli s ní Forgejo nejspíše bude pracovat, mohou nastat určité vzácné případy, kdy nebude pracovat tak, jak má.
33993399-self_check.database_fix_mssql = Uživatelé MSSQL mohou tento problém vyřešit pouze ručními SQL příkazy „ALTER ... COLLATE ...“.
34003399auths.oauth2_map_group_to_team = Zmapovat zabrané skupiny u týmů organizací (volitelné - vyžaduje název claimu výše)
34013400monitor.queue.settings.desc = Pooly dynamicky rostou podle blokování fronty jejich workerů.
34023401···34053404self_check.database_collation_case_insensitive=Databáze používá collation %s, což je collation nerozlišující velká a malá písmena. Ačkoli s ní Gitea může pracovat, mohou se vyskytnout vzácné případy, kdy nebude fungovat podle očekávání.
34063405self_check.database_inconsistent_collation_columns=Databáze používá collation %s, ale tyto sloupce používají chybné collation. To může způsobit neočekávané problémy.
34073406self_check.database_fix_mysql=Pro uživatele MySQL/MariaDB můžete použít příkaz "gitea doctor convert", který opraví problémy s collation, nebo můžete také problém vyřešit příkazem "ALTER ... COLLATE ..." SQL ručně.
34083408-self_check.database_fix_mssql=Uživatelé MSSQL mohou problém vyřešit pouze pomocí příkazu "ALTER ... COLLATE ..." SQL ručně.
34093407auths.tips.gmail_settings = Nastavení služby Gmail:
34103408config_summary = Souhrn
34113409config.open_with_editor_app_help = Editory v nabídce „Otevřít pomocí“ v nabídce klonování. Ponechte prázdné pro použití výchozího editoru (zobrazíte jej rozšířením).
+1-2
options/locale/locale_de-DE.ini
···217217install=Installation
218218title=Erstkonfiguration
219219docker_helper=Wenn du Forgejo in einem Docker-Container nutzt, lies bitte die <a target="_blank" rel="noopener noreferrer" href="%s">Dokumentation</a>, bevor du irgendwelche Einstellungen veränderst.
220220-require_db_desc=Forgejo benötigt MySQL, PostgreSQL, MSSQL, SQLite3 oder TiDB (MySQL-Protokoll).
220220+require_db_desc=Forgejo benötigt MySQL, PostgreSQL, SQLite3 oder TiDB (MySQL-Protokoll).
221221db_title=Datenbankeinstellungen
222222db_type=Datenbanktyp
223223host=Host
···33683368dashboard.sync_repo_tags = Tags aus Git-Daten zu Datenbank synchronisieren
33693369emails.change_email_text = Bist du dir sicher, dass du diese E-Mail-Addresse aktualisieren möchtest?
33703370packages.cleanup.success = Abgelaufene Daten erfolgreich gesäubert
33713371-self_check.database_fix_mssql = Für MSSQL-Benutzer: Du kannst das Problem im Moment nur mit „ALTER … COLLATE …“-SQLs beheben.
33723371self_check.no_problem_found = Noch kein Problem gefunden.
33733372self_check.database_inconsistent_collation_columns = Datenbank benutzt Collation %s, aber diese Spalten benutzen Collations, die nicht zusammenpassen. Das könnte ein paar unerwartete Probleme verursachen.
33743373self_check.database_collation_mismatch = Erwarte von Datenbank, folgende Collation zu verwenden: %s
+1-2
options/locale/locale_el-GR.ini
···211211install=Εγκατάσταση
212212title=Αρχικές ρυθμίσεις
213213docker_helper=Αν εκτελέσετε το Forgejo μέσα στο Docker, παρακαλώ διαβάστε το <a target="_blank" rel="noopener noreferrer" href="%s">εγχειρίδιο</a> πριν αλλάξετε τις ρυθμίσεις.
214214-require_db_desc=Το Forgejo απαιτεί MySQL, PostgreSQL, MSSQL, SQLite3 ή TiDB (με πρωτόκολλο MySQL).
214214+require_db_desc=Το Forgejo απαιτεί MySQL, PostgreSQL, SQLite3 ή TiDB (με πρωτόκολλο MySQL).
215215db_title=Ρυθμίσεις βάσης δεδομένων
216216db_type=Είδος βάσης δεδομένων
217217host=Διακομιστής
···33223322notices.op=Λειτ.
33233323notices.delete_success=Οι ειδοποιήσεις του συστήματος έχουν διαγραφεί.
33243324self_check.no_problem_found = Μέχρι τώρα, δεν έχει βρεθεί κάποιο πρόβλημα.
33253325-self_check.database_fix_mssql = Προς το παρόν, οι χρήστες του MSSQL μπορούν να διορθώσουν το πρόβλημα αυτό χειροκίνητα χρησιμοποιώντας τις εντολές SQL «ALTER ... COLLATE ...».
33263325self_check = Αυτοέλεγχος
33273326dashboard.sync_repo_tags = Συγχρονισμός tag από δεδομένα git στην βάση δεδομένων
33283327dashboard.sync_tag.started = Ο συγχρονισμός tag έχει ξεκινήσει
+1-2
options/locale/locale_en-US.ini
···239239install = Installation
240240title = Initial configuration
241241docker_helper = If you run Forgejo inside Docker, please read the <a target="_blank" rel="noopener noreferrer" href="%s">documentation</a> before changing any settings.
242242-require_db_desc = Forgejo requires MySQL, PostgreSQL, MSSQL, SQLite3 or TiDB (MySQL protocol).
242242+require_db_desc = Forgejo requires MySQL, PostgreSQL, SQLite3 or TiDB (MySQL protocol).
243243db_title = Database settings
244244db_type = Database type
245245host = Host
···33783378self_check.database_collation_case_insensitive = Database is using a collation %s, which is an insensitive collation. Although Forgejo could work with it, there might be some rare cases which don't work as expected.
33793379self_check.database_inconsistent_collation_columns = Database is using collation %s, but these columns are using mismatched collations. It might cause some unexpected problems.
33803380self_check.database_fix_mysql = For MySQL/MariaDB users, you could use the "gitea doctor convert" command to fix the collation problems, or you could also fix the problem by "ALTER ... COLLATE ..." SQLs manually.
33813381-self_check.database_fix_mssql = For MSSQL users, you could only fix the problem by "ALTER ... COLLATE ..." SQLs manually at the moment.
3382338133833382[action]
33843383create_repo = created repository <a href="%s">%s</a>
+1-1
options/locale/locale_eo.ini
···226226repo_path_helper = Foraj Git-deponejoj konserviĝos al tiu ĉi dosierujo.
227227sqlite_helper = Dosiervojo por la datumbazo SQLite3.<br>Enigu absolutan vojon se vi rulas Forgejon kiel servo.
228228enable_captcha = Ŝalti dumregistriĝan teston de homeco
229229-require_db_desc = Forgejo bezonas kiel datumbazo MySQL, PostgreSQL, MSSQL, SQLite3, aŭ TiDB (MySQL komunikformo).
229229+require_db_desc = Forgejo bezonas kiel datumbazo MySQL, PostgreSQL, SQLite3, aŭ TiDB (MySQL komunikformo).
230230smtp_from = Sendu retleterojn kiel
231231general_title = Ĝeneralaj agordoj
232232password = Pasvorto
+1-1
options/locale/locale_es-ES.ini
···210210install=Instalación
211211title=Configuración inicial
212212docker_helper=Si está ejecutando Forgejo dentro de un contenedor Docker, por favor lea la <a target="_blank" rel="noopener noreferrer" href="%s">documentación</a> antes de realizar cambios en la configuración.
213213-require_db_desc=Forgejo requiere una base de datos MySQL, PostgreSQL, MSSQL, SQLite3 o TiDB (usar el protocolo MySQL).
213213+require_db_desc=Forgejo requiere una base de datos MySQL, PostgreSQL, SQLite3 o TiDB (usar el protocolo MySQL).
214214db_title=Configuración de base de datos
215215db_type=Tipo de base de datos
216216host=Servidor
+1-1
options/locale/locale_fi-FI.ini
···144144install=Asennus
145145title=Alkuperäiset asetukset
146146docker_helper=Jos ajat Forgejoa Dockerin sisällä, lue <a target="_blank" rel="noopener noreferrer" href="%s">ohjeet</a> ennen minkään asetuksen muuttamista.
147147-require_db_desc=Forgejo tarvitsee toimiakseen MySQL, PostgreSQL, MSSQL, SQLite3 tai TiDB (MySQL protokolla) tietokannan.
147147+require_db_desc=Forgejo tarvitsee toimiakseen MySQL, PostgreSQL, SQLite3 tai TiDB (MySQL protokolla) tietokannan.
148148db_title=Tietokanta asetukset
149149db_type=Tietokanta tyyppi
150150host=Isäntä
+1-1
options/locale/locale_fil.ini
···211211install = Pag-install
212212title = Paunang pagsasaayos
213213docker_helper = Kapag tinatakbo mo ang Forgejo sa loob ng Docker, mangyaring basahin ang <a target="_blank" rel="noopener noreferrer" href="%s">dokumentasyon</a> bago baguhin ang anumang mga setting.
214214-require_db_desc = Kinakailangan ng Forgejo ang MySQL, PostgreSQL, MSSQL, SQLite3 o TiDB (MySQL protocol).
214214+require_db_desc = Kinakailangan ng Forgejo ang MySQL, PostgreSQL, SQLite3 o TiDB (MySQL protocol).
215215db_title = Mga setting ng database
216216db_type = Uri ng database
217217host = Host
+1-3
options/locale/locale_fr-FR.ini
···218218install=Installation
219219title=Configuration initiale
220220docker_helper=Si vous exécutez Forgejo dans Docker, veuillez lire la <a target="_blank" rel="noopener noreferrer" href="%s">documentation</a> avant de modifier les paramètres.
221221-require_db_desc=Forgejo nécessite MySQL, PostgreSQL, MSSQL, SQLite3 ou TiDB (avec le protocole MySQL).
221221+require_db_desc=Forgejo nécessite MySQL, PostgreSQL, SQLite3 ou TiDB (avec le protocole MySQL).
222222db_title=Paramètres de la base de données
223223db_type=Type de base de données
224224host=Hôte
···33883388self_check.database_collation_case_insensitive = La base de donnée utilise la collation %s qui n'est pas sensible à la casse. Bien que Forgejo puisse fonctionner de cette façon, il est possible que certains cas limite d'utilisation de la casse ne fonctionne pas comme attendu.
33893389self_check.database_inconsistent_collation_columns = La base de donnée utilise la collation %s, mais ces colonnes utilisent des collations incohérentes. Cela peut causer des problèmes inattendus.
33903390self_check.database_fix_mysql = Les utilisateurs de MySQL/MariaDB peuvent utiliser la commande "forgejo doctor convert" pour corriger les problèmes de collation, ou bien manuellement avec la commande SQL "ALTER ... COLLATE ...".
33913391-self_check.database_fix_mssql = Les utilisateurs de MSSQL sont pour l'instant contraint d'utiliser la commande SQL "ALTER ... COLLATE ..." pour corriger ce problème.
3392339133933392self_check.no_problem_found=Aucun problème trouvé pour l’instant.
33943393self_check.database_collation_mismatch=Exige que la base de données utilise la collation %s.
33953394self_check.database_collation_case_insensitive=La base de données utilise la collation %s, insensible à la casse. Bien que Gitea soit compatible, il peut y avoir quelques rares cas qui ne fonctionnent pas comme prévu.
33963395self_check.database_inconsistent_collation_columns=La base de données utilise la collation %s, mais ces colonnes utilisent des collations différentes. Cela peut causer des problèmes imprévus.
33973396self_check.database_fix_mysql=Pour les utilisateurs de MySQL ou MariaDB, vous pouvez utiliser la commande « gitea doctor convert » dans un terminal ou exécuter une requête du type « ALTER … COLLATE ... » pour résoudre les problèmes de collation.
33983398-self_check.database_fix_mssql=Pour les utilisateurs de MSSQL, vous ne pouvez résoudre le problème qu’en exécutant une requête SQL du type « ALTER … COLLATE … ».
3399339734003398[action]
34013399create_repo=a créé le dépôt <a href="%s">%s</a>
+1-1
options/locale/locale_is-IS.ini
···141141install=Uppsetning
142142title=Upphafleg Uppsetning
143143docker_helper=Ef þú keyrir Forgejo inni í Docker þá viltu vinsamlegast lesa <a target="_blank" rel="noopener noreferrer" href="%s">leiðbeiningaritið</a> áður en þú breytir stillingum.
144144-require_db_desc=Forgejo krefst MySQL, PostgreSQL, MSSQL, SQLite3 eða TiDB (MySQL samskiptareglur).
144144+require_db_desc=Forgejo krefst MySQL, PostgreSQL, SQLite3 eða TiDB (MySQL samskiptareglur).
145145db_title=Gagnagrunnsstillingar
146146db_type=Tegund Gagnagrunns
147147host=Hýsill
+1-2
options/locale/locale_it-IT.ini
···215215install=Installazione
216216title=Configurazione iniziale
217217docker_helper=Se stai usando Forgejo con Docker, leggi <a target="_blank" rel="noopener noreferrer" href="%s">la documentazione</a> prima di cambiare qualsiasi impostazione.
218218-require_db_desc=Forgejo requires MySQL, PostgreSQL, MSSQL, SQLite3 or TiDB (MySQL protocol).
218218+require_db_desc=Forgejo requires MySQL, PostgreSQL, SQLite3 or TiDB (MySQL protocol).
219219db_title=Impostazioni database
220220db_type=Tipo di database
221221host=Host
···33513351self_check.database_collation_mismatch = Pretendi che la base di dati usi la collazione: %s
33523352self_check.database_fix_mysql = Per utenti MySQL/MariaDB, potresti usare il comando "gitea doctor convert" per risolvere problemi di collazione, o potresti risolvere il problema manualmente tramite SQL con "ALTER ... COLLATE ...".
33533353self_check.database_collation_case_insensitive = La base di dati sta usando la collazione %s, che è una collazione insensibile. Nonostante Forgejo potrebbe lavorarci, ci potrebbero essere rari casi che non vanno come previsto.
33543354-self_check.database_fix_mssql = Gli utenti MSSQL possono provare a risolvere il problema tramite SQL con "ALTER ... COLLATE ..." manualmente, per il momento.
335533543356335533573356[action]
···197197install=Instalācija
198198title=Sākotnējā konfigurācija
199199docker_helper=Ja Forgejo ir uzstādīts Docker konteinerī, izlasiet <a target="_blank" rel="noopener noreferrer" href="%s">vadlīninas</a> pirms maināt iestatījumus.
200200-require_db_desc=Forgejo nepieciešams MySQL, PostgreSQL, MSSQL, SQLite3 vai TiDB (izmantojot MySQL protokolu).
200200+require_db_desc=Forgejo nepieciešams MySQL, PostgreSQL, SQLite3 vai TiDB (izmantojot MySQL protokolu).
201201db_title=Datu bāzes iestatījumi
202202db_type=Datu bāzes veids
203203host=Resursdators
+1-2
options/locale/locale_nl-NL.ini
···217217install=Installatie
218218title=Initiële configuratie
219219docker_helper=Als je gitea draait in Docker, Lees eerst de <a target="_blank" rel="noopener noreferrer" href="%s">documentatie</a> voordat je een instelling aanpast.
220220-require_db_desc=Forgejo vereist MySQL, PostgreSQL, MSSQL, SQLite3 of TiDB (MySQL protocol).
220220+require_db_desc=Forgejo vereist MySQL, PostgreSQL, SQLite3 of TiDB (MySQL protocol).
221221db_title=Database-instellingen
222222db_type=Database-type
223223host=Server
···33233323monitor.processes_count = %d Processen
33243324monitor.process.children = Kinderen
33253325self_check.database_inconsistent_collation_columns = Database gebruikt collatie %s, maar deze kolommen gebruiken onjuiste collaties. Dit kan onverwachte problemen veroorzaken.
33263326-self_check.database_fix_mssql = Voor MSSQL gebruikers kan je het probleem alleen oplossen door "ALTER ... COLLATE ..." SQL's handmatig op te lossen.
33273326monitor.stacktrace = Stacktrace
33283327monitor.download_diagnosis_report = Diagnoserapport downloaden
33293328self_check.database_collation_case_insensitive = Database gebruikt collatie %s, wat een ongevoelige collatie is. Hoewel Forgejo ermee kan werken, kunnen er enkele zeldzame gevallen zijn die niet werken zoals verwacht.
+1-1
options/locale/locale_pl-PL.ini
···160160install=Instalacja
161161title=Wstępna konfiguracja
162162docker_helper=Jeśli używasz Forgejo za pomocą Docker'a, przeczytaj <a target="_blank" rel="noopener noreferrer" href="%s">dokumentację</a> przed wprowadzeniem jakichkolwiek zmian.
163163-require_db_desc=Forgejo wymaga MySQL, PostgreSQL, MSSQL, SQLite3 lub TiDB (protokół MySQL).
163163+require_db_desc=Forgejo wymaga MySQL, PostgreSQL, SQLite3 lub TiDB (protokół MySQL).
164164db_title=Ustawienia bazy danych
165165db_type=Typ bazy danych
166166host=Serwer
+1-1
options/locale/locale_pt-BR.ini
···205205install=Instalação
206206title=Configuração inicial
207207docker_helper=Se você está rodando o Forgejo dentro do Docker, por favor leia a <a target="_blank" rel="noopener noreferrer" href="%s">documentação</a> cuidadosamente antes de alterar qualquer coisa nesta página.
208208-require_db_desc=Forgejo requer MySQL, PostgreSQL, MSSQL, SQLite3 ou TiDB (protocolo MySQL).
208208+require_db_desc=Forgejo requer MySQL, PostgreSQL, SQLite3 ou TiDB (protocolo MySQL).
209209db_title=Configurações de banco de dados
210210db_type=Tipo de banco de dados
211211host=Servidor
+1-2
options/locale/locale_pt-PT.ini
···198198install=Instalação
199199title=Configuração inicial
200200docker_helper=Se correr o Forgejo dentro do Docker, leia a <a target="_blank" rel="noopener noreferrer" href="%s">documentação</a> antes de alterar quaisquer configurações.
201201-require_db_desc=Forgejo requer MySQL, PostgreSQL, MSSQL, SQLite3 ou TiDB (protocolo MySQL).
201201+require_db_desc=Forgejo requer MySQL, PostgreSQL, SQLite3 ou TiDB (protocolo MySQL).
202202db_title=Configurações da base de dados
203203db_type=Tipo de base de dados
204204host=Servidor
···32563256self_check.database_collation_case_insensitive=A base de dados está a usar a colação %s, que é insensível à diferença entre maiúsculas e minúsculas. Embora o Gitea possa trabalhar com ela, pode haver alguns casos raros que não funcionem como esperado.
32573257self_check.database_inconsistent_collation_columns=A base de dados está a usar a colação %s, mas estas colunas estão a usar colações diferentes. Isso poderá causar alguns problemas inesperados.
32583258self_check.database_fix_mysql=Para utilizadores do MySQL/MariaDB, pode usar o comando "gitea doctor convert" para resolver os problemas de colação. Também pode resolver o problema com comandos SQL "ALTER ... COLLATE ..." aplicados manualmente.
32593259-self_check.database_fix_mssql=Para utilizadores do MSSQL só pode resolver o problema aplicando comandos SQL "ALTER ... COLLATE ..." manualmente, por enquanto.
3260325932613260[action]
32623261create_repo=criou o repositório <a href="%s">%s</a>
+1-2
options/locale/locale_ru-RU.ini
···217217install=Установка
218218title=Начальная конфигурация
219219docker_helper=Если вы запускаете Forgejo под Docker, пожалуйста, ознакомьтесь с <a target="_blank" rel="noopener noreferrer" href="%s">документацией</a>, прежде чем изменять любые настройки.
220220-require_db_desc=Forgejo требует MySQL, PostgreSQL, MSSQL, SQLite3 или TiDB (по протоколу MySQL).
220220+require_db_desc=Forgejo требует MySQL, PostgreSQL, SQLite3 или TiDB (по протоколу MySQL).
221221db_title=Настройки базы данных
222222db_type=Тип базы данных
223223host=Хост
···33493349self_check.no_problem_found = Пока проблем не обнаружено.
33503350auths.tip.gitea = Зарегистрируйте новое приложение OAuth2. Доступна инструкция: https://forgejo.org/docs/latest/user/oauth2-provider
33513351auths.tips.oauth2.general.tip = При регистрации нового приложения OAuth2 ссылка обратного перенаправления должна быть:
33523352-self_check.database_fix_mssql = В настоящий момент пользователи MSSQL могут исправить проблемы с сопоставлением только ручным прописыванием "ALTER ... COLLATE ..." в SQL.
33533352self_check.database_fix_mysql = Пользователи MySQL и MariaDB могут исправить проблемы с сопоставлением командой "gitea doctor convert". Также можно вручную вписать "ALTER ... COLLATE ..." в SQL.
33543353dashboard.cleanup_actions = Очистить устаревшие журналы и артефакты Действий
33553354dashboard.sync_repo_branches = Синхронизировать ветки из Git в базу данных
+1-1
options/locale/locale_sk-SK.ini
···196196install=Inštalácia
197197title=Východzia konfigurácia
198198docker_helper=Ak spúšťate Forgejo v Docker kontajneri, prečítajte si <a target="_blank" rel="noopener noreferrer" href="%s">dokumentáciu</a> pred zmenou akýchkoľvek nastavení.
199199-require_db_desc=Forgejo vyžaduje MySQL, PostgreSQL, MSSQL, SQLite3 alebo TiDB (MySQL protokol).
199199+require_db_desc=Forgejo vyžaduje MySQL, PostgreSQL, SQLite3 alebo TiDB (MySQL protokol).
200200db_title=Nastavenie databázy
201201db_type=Typ databázy
202202host=Host
+1-1
options/locale/locale_sl.ini
···133133134134[install]
135135reinstall_confirm_check_3 = Potrjujete, da ste popolnoma prepričani, da se ta program Forgejo izvaja s pravilno lokacijo app.ini, in da ste prepričani, da ga morate znova namestiti. Potrjujete, da se zavedate zgoraj navedenih tveganj.
136136-require_db_desc = Forgejo zahteva MySQL, PostgreSQL, MSSQL, SQLite3 ali TiDB (protokol MySQL).
136136+require_db_desc = Forgejo zahteva MySQL, PostgreSQL, SQLite3 ali TiDB (protokol MySQL).
137137password_algorithm_helper = Nastavite algoritem za stiskanje gesla. Algoritmi imajo različne zahteve in moč. Algoritem argon2 je precej varen, vendar porabi veliko pomnilnika in je lahko neprimeren za majhne sisteme.
138138reinstall_confirm_message = Ponovna namestitev z obstoječo zbirko podatkov Forgejo lahko povzroči več težav. V večini primerov morate za zagon programa Forgejo uporabiti obstoječi "app.ini". Če veste, kaj počnete, potrdite naslednje:
139139err_admin_name_is_reserved = Administrator Uporabniško ime je neveljavno, uporabniško ime je rezervirano
+1-1
options/locale/locale_tr-TR.ini
···197197install=Kurulum
198198title=Başlangıç Yapılandırması
199199docker_helper=Eğer Forgejo'yı Docker içerisinde çalıştırıyorsanız, lütfen herhangi bir değişiklik yapmadan önce <a target="_blank" rel="noopener noreferrer" href="%s">belgeleri</a> okuyun.
200200-require_db_desc=Forgejo MySQL, PostgreSQL, MSSQL, SQLite3 veya TiDB (MySQL protokolü) gerektirir.
200200+require_db_desc=Forgejo MySQL, PostgreSQL, SQLite3 veya TiDB (MySQL protokolü) gerektirir.
201201db_title=Veritabanı Ayarları
202202db_type=Veritabanı Türü
203203host=Sunucu
···77make test-sqlite
88make test-pgsql
99make test-mysql
1010-make test-mssql
1110```
12111312Make sure to perform a clean front-end build before running tests:
···5352TEST_PGSQL_HOST=localhost:5432 TEST_PGSQL_DBNAME=test TEST_PGSQL_USERNAME=postgres TEST_PGSQL_PASSWORD=postgres make test-e2e-pgsql
5453```
55545656-## Run mssql e2e tests
5757-Setup a mssql database inside docker
5858-```
5959-docker run -e "ACCEPT_EULA=Y" -e "MSSQL_PID=Standard" -e "SA_PASSWORD=MwantsaSecurePassword1" -p 1433:1433 --rm --name mssql microsoft/mssql-server-linux:latest #(just ctrl-c to stop db and clean the container)
6060-```
6161-Start tests based on the database container
6262-```
6363-TEST_MSSQL_HOST=localhost:1433 TEST_MSSQL_DBNAME=gitea_test TEST_MSSQL_USERNAME=sa TEST_MSSQL_PASSWORD=MwantsaSecurePassword1 make test-e2e-mssql
6464-```
6565-6655## Running individual tests
67566857Example command to run `example.test.e2e.js` test file:
···7564make test-e2e-sqlite#example
7665```
77667878-For other databases(replace `mssql` to `mysql` or `pgsql`):
6767+For PostgreSQL databases(replace `mysql` to `pgsql`):
79688069```
8181-TEST_MSSQL_HOST=localhost:1433 TEST_MSSQL_DBNAME=test TEST_MSSQL_USERNAME=sa TEST_MSSQL_PASSWORD=MwantsaSecurePassword1 make test-e2e-mssql#example
7070+TEST_MYSQL_HOST=localhost:1433 TEST_MYSQL_DBNAME=test TEST_MYSQL_USERNAME=sa TEST_MYSQL_PASSWORD=MwantsaSecurePassword1 make test-e2e-mysql#example
8271```
83728473## Visual testing
+2-13
tests/integration/README.md
···66make test-sqlite
77make test-pgsql
88make test-mysql
99-make test-mssql
109```
11101211Make sure to perform a clean build before running tests:
···6362TEST_PGSQL_HOST=localhost:5432 TEST_PGSQL_DBNAME=test TEST_PGSQL_USERNAME=postgres TEST_PGSQL_PASSWORD=postgres make test-pgsql
6463```
65646666-## Run mssql integration tests
6767-Setup a mssql database inside docker
6868-```
6969-docker run -e "ACCEPT_EULA=Y" -e "MSSQL_PID=Standard" -e "SA_PASSWORD=MwantsaSecurePassword1" -p 1433:1433 --rm --name mssql microsoft/mssql-server-linux:latest #(just ctrl-c to stop db and clean the container)
7070-```
7171-Start tests based on the database container
7272-```
7373-TEST_MSSQL_HOST=localhost:1433 TEST_MSSQL_DBNAME=gitea_test TEST_MSSQL_USERNAME=sa TEST_MSSQL_PASSWORD=MwantsaSecurePassword1 make test-mssql
7474-```
7575-7665## Running individual tests
77667867Example command to run GPG test:
···8372make test-sqlite#GPG
8473```
85748686-For other databases(replace `mssql` to `mysql`, or `pgsql`):
7575+For other databases (replace `mysql` to `pgsql`):
87768877```
8989-TEST_MSSQL_HOST=localhost:1433 TEST_MSSQL_DBNAME=test TEST_MSSQL_USERNAME=sa TEST_MSSQL_PASSWORD=MwantsaSecurePassword1 make test-mssql#GPG
7878+TEST_MYSQL_HOST=localhost:1433 TEST_MYSQL_DBNAME=test TEST_MYSQL_USERNAME=sa TEST_MYSQL_PASSWORD=MwantsaSecurePassword1 make test-mysql#GPG
9079```
91809281## Setting timeouts for declaring long-tests and long-flushes
+2-12
tests/integration/README_ZH.md
···5959TEST_PGSQL_HOST=localhost:5432 TEST_PGSQL_DBNAME=test TEST_PGSQL_USERNAME=postgres TEST_PGSQL_PASSWORD=postgres make test-pgsql
6060```
61616262-## Run mssql integration tests
6363-同上,首先在 docker 容器里部署一个 mssql 数据库
6464-```
6565-docker run -e "ACCEPT_EULA=Y" -e "MSSQL_PID=Standard" -e "SA_PASSWORD=MwantsaSecurePassword1" -p 1433:1433 --rm --name mssql microsoft/mssql-server-linux:latest #(just ctrl-c to stop db and clean the container)
6666-```
6767-之后便可以基于这个数据库进行集成测试
6868-```
6969-TEST_MSSQL_HOST=localhost:1433 TEST_MSSQL_DBNAME=gitea_test TEST_MSSQL_USERNAME=sa TEST_MSSQL_PASSWORD=MwantsaSecurePassword1 make test-mssql
7070-```
7171-7262## 如何进行自定义的集成测试
73637464下面的示例展示了怎样在集成测试中只进行 GPG 测试:
···7969make test-sqlite#GPG
8070```
81718282-其它数据库(把 MSSQL 替换为 MYSQL, PGSQL):
7272+其它数据库 (用 PGSQL 取代 MYSQL):
83738474```
8585-TEST_MSSQL_HOST=localhost:1433 TEST_MSSQL_DBNAME=test TEST_MSSQL_USERNAME=sa TEST_MSSQL_PASSWORD=MwantsaSecurePassword1 make test-mssql#GPG
7575+TEST_MYSQL_HOST=localhost:1433 TEST_MYSQL_DBNAME=test TEST_MYSQL_USERNAME=sa TEST_MYSQL_PASSWORD=MwantsaSecurePassword1 make test-mysql#GPG
8676```
8777
+4-14
tests/integration/db_collation_test.go
···3939 htmlDoc.AssertElement(t, "a.item[href*='/admin/self_check']", exists)
4040 }
41414242- if setting.Database.Type.IsMySQL() || setting.Database.Type.IsMSSQL() {
4242+ if setting.Database.Type.IsMySQL() {
4343 assertSelfCheckExists(true)
4444 } else {
4545 assertSelfCheckExists(false)
···6161 assert.EqualValues(t, 2, cnt)
6262 _, _ = x.Exec("DROP TABLE IF EXISTS test_collation_tbl")
63636464- // by default, SQLite3 and PostgreSQL are using case-sensitive collations, but MySQL and MSSQL are not
6565- // the following tests are only for MySQL and MSSQL
6666- if !setting.Database.Type.IsMySQL() && !setting.Database.Type.IsMSSQL() {
6767- t.Skip("only MySQL and MSSQL requires the case-sensitive collation check at the moment")
6464+ // by default, SQLite3 and PostgreSQL are using case-sensitive collations, but MySQL is not.
6565+ if !setting.Database.Type.IsMySQL() {
6666+ t.Skip("only MySQL requires the case-sensitive collation check at the moment")
6867 return
6968 }
7069···8685 assert.True(t, r.CollationEquals("abc", "abc"))
8786 assert.True(t, r.CollationEquals("abc", "utf8mb4_abc"))
8887 assert.False(t, r.CollationEquals("utf8mb4_general_ci", "utf8mb4_unicode_ci"))
8989- } else if setting.Database.Type.IsMSSQL() {
9090- assert.True(t, r.IsCollationCaseSensitive("Latin1_General_CS_AS"))
9191- assert.False(t, r.IsCollationCaseSensitive("Latin1_General_CI_AS"))
9292- assert.True(t, r.CollationEquals("abc", "abc"))
9393- assert.False(t, r.CollationEquals("Latin1_General_CS_AS", "SQL_Latin1_General_CP1_CS_AS"))
9488 } else {
9589 assert.Fail(t, "unexpected database type")
9690 }
9791 })
9898-9999- if setting.Database.Type.IsMSSQL() {
100100- return // skip table converting tests because MSSQL doesn't have a simple solution at the moment
101101- }
1029210393 t.Run("Convert tables to utf8mb4_bin", func(t *testing.T) {
10494 defer tests.PrintCurrentTest(t)()