loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

[CHORE] Remove Microsoft SQL Server Support

- Per https://codeberg.org/forgejo/discussions/issues/122

Gusted 2d9afd0c af47c583

+70 -789
-1
.gitea/issue_template/bug-report.yaml
··· 87 87 - SQLite 88 88 - PostgreSQL 89 89 - MySQL 90 - - MSSQL
+1 -60
Makefile
··· 196 196 TEST_PGSQL_USERNAME ?= postgres 197 197 TEST_PGSQL_PASSWORD ?= postgres 198 198 TEST_PGSQL_SCHEMA ?= gtestschema 199 - TEST_MSSQL_HOST ?= mssql:1433 200 - TEST_MSSQL_DBNAME ?= gitea 201 - TEST_MSSQL_USERNAME ?= sa 202 - TEST_MSSQL_PASSWORD ?= MwantsaSecurePassword1 203 199 204 200 .PHONY: all 205 201 all: build ··· 309 305 e2e*.test \ 310 306 tests/integration/gitea-integration-* \ 311 307 tests/integration/indexers-* \ 312 - tests/mysql.ini tests/pgsql.ini tests/mssql.ini man/ \ 308 + tests/mysql.ini tests/pgsql.ini man/ \ 313 309 tests/e2e/gitea-e2e-*/ \ 314 310 tests/e2e/indexers-*/ \ 315 311 tests/e2e/reports/ tests/e2e/test-artifacts/ tests/e2e/test-snapshots/ ··· 612 608 .PHONY: test-pgsql-migration 613 609 test-pgsql-migration: migrations.pgsql.test migrations.individual.pgsql.test 614 610 615 - generate-ini-mssql: 616 - sed -e 's|{{TEST_MSSQL_HOST}}|${TEST_MSSQL_HOST}|g' \ 617 - -e 's|{{TEST_MSSQL_DBNAME}}|${TEST_MSSQL_DBNAME}|g' \ 618 - -e 's|{{TEST_MSSQL_USERNAME}}|${TEST_MSSQL_USERNAME}|g' \ 619 - -e 's|{{TEST_MSSQL_PASSWORD}}|${TEST_MSSQL_PASSWORD}|g' \ 620 - -e 's|{{REPO_TEST_DIR}}|${REPO_TEST_DIR}|g' \ 621 - -e 's|{{TEST_LOGGER}}|$(or $(TEST_LOGGER),test$(COMMA)file)|g' \ 622 - -e 's|{{TEST_TYPE}}|$(or $(TEST_TYPE),integration)|g' \ 623 - tests/mssql.ini.tmpl > tests/mssql.ini 624 - 625 - .PHONY: test-mssql 626 - test-mssql: integrations.mssql.test generate-ini-mssql 627 - GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/mssql.ini ./integrations.mssql.test 628 - 629 - .PHONY: test-mssql\#% 630 - test-mssql\#%: integrations.mssql.test generate-ini-mssql 631 - GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/mssql.ini ./integrations.mssql.test -test.run $(subst .,/,$*) 632 - 633 - .PHONY: test-mssql-migration 634 - test-mssql-migration: migrations.mssql.test migrations.individual.mssql.test 635 - 636 611 .PHONY: playwright 637 612 playwright: deps-frontend 638 613 npx playwright install $(PLAYWRIGHT_FLAGS) ··· 669 644 test-e2e-pgsql\#%: playwright e2e.pgsql.test generate-ini-pgsql 670 645 GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/pgsql.ini ./e2e.pgsql.test -test.run TestE2e/$* 671 646 672 - .PHONY: test-e2e-mssql 673 - test-e2e-mssql: playwright e2e.mssql.test generate-ini-mssql 674 - GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/mssql.ini ./e2e.mssql.test -test.run TestE2e 675 - 676 - .PHONY: test-e2e-mssql\#% 677 - test-e2e-mssql\#%: playwright e2e.mssql.test generate-ini-mssql 678 - GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/mssql.ini ./e2e.mssql.test -test.run TestE2e/$* 679 - 680 647 .PHONY: test-e2e-debugserver 681 648 test-e2e-debugserver: e2e.sqlite.test generate-ini-sqlite 682 649 sed -i s/3003/3000/g tests/sqlite.ini ··· 689 656 .PHONY: bench-mysql 690 657 bench-mysql: integrations.mysql.test generate-ini-mysql 691 658 GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/mysql.ini ./integrations.mysql.test -test.cpuprofile=cpu.out -test.run DontRunTests -test.bench . 692 - 693 - .PHONY: bench-mssql 694 - bench-mssql: integrations.mssql.test generate-ini-mssql 695 - GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/mssql.ini ./integrations.mssql.test -test.cpuprofile=cpu.out -test.run DontRunTests -test.bench . 696 659 697 660 .PHONY: bench-pgsql 698 661 bench-pgsql: integrations.pgsql.test generate-ini-pgsql ··· 712 675 integrations.pgsql.test: git-check $(GO_SOURCES) 713 676 $(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/tests/integration -o integrations.pgsql.test 714 677 715 - integrations.mssql.test: git-check $(GO_SOURCES) 716 - $(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/tests/integration -o integrations.mssql.test 717 - 718 678 integrations.sqlite.test: git-check $(GO_SOURCES) 719 679 $(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/tests/integration -o integrations.sqlite.test -tags '$(TEST_TAGS)' 720 680 ··· 733 693 migrations.pgsql.test: $(GO_SOURCES) generate-ini-pgsql 734 694 $(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/tests/integration/migration-test -o migrations.pgsql.test 735 695 GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/pgsql.ini ./migrations.pgsql.test 736 - 737 - .PHONY: migrations.mssql.test 738 - migrations.mssql.test: $(GO_SOURCES) generate-ini-mssql 739 - $(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/tests/integration/migration-test -o migrations.mssql.test 740 - GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/mssql.ini ./migrations.mssql.test 741 696 742 697 .PHONY: migrations.sqlite.test 743 698 migrations.sqlite.test: $(GO_SOURCES) generate-ini-sqlite ··· 764 719 migrations.individual.pgsql.test\#%: $(GO_SOURCES) generate-ini-pgsql 765 720 GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/pgsql.ini $(GO) test $(GOTESTFLAGS) -tags '$(TEST_TAGS)' code.gitea.io/gitea/models/migrations/$* 766 721 767 - 768 - .PHONY: migrations.individual.mssql.test 769 - migrations.individual.mssql.test: $(GO_SOURCES) generate-ini-mssql 770 - for pkg in $(MIGRATION_PACKAGES); do \ 771 - GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/mssql.ini $(GO) test $(GOTESTFLAGS) -tags '$(TEST_TAGS)' -test.failfast $$pkg || exit 1; \ 772 - done 773 - 774 - .PHONY: migrations.individual.mssql.test\#% 775 - migrations.individual.mssql.test\#%: $(GO_SOURCES) generate-ini-mssql 776 - GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/mssql.ini $(GO) test $(GOTESTFLAGS) -tags '$(TEST_TAGS)' code.gitea.io/gitea/models/migrations/$* 777 - 778 722 .PHONY: migrations.individual.sqlite.test 779 723 migrations.individual.sqlite.test: $(GO_SOURCES) generate-ini-sqlite 780 724 for pkg in $(MIGRATION_PACKAGES); do \ ··· 790 734 791 735 e2e.pgsql.test: $(GO_SOURCES) 792 736 $(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/tests/e2e -o e2e.pgsql.test 793 - 794 - e2e.mssql.test: $(GO_SOURCES) 795 - $(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/tests/e2e -o e2e.mssql.test 796 737 797 738 e2e.sqlite.test: $(GO_SOURCES) 798 739 $(GO) test $(GOTESTFLAGS) -c code.gitea.io/gitea/tests/e2e -o e2e.sqlite.test -tags '$(TEST_TAGS)'
-15
assets/go-licenses.json
··· 295 295 "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" 296 296 }, 297 297 { 298 - "name": "github.com/denisenkom/go-mssqldb", 299 - "path": "github.com/denisenkom/go-mssqldb/LICENSE.txt", 300 - "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" 301 - }, 302 - { 303 298 "name": "github.com/dgryski/go-rendezvous", 304 299 "path": "github.com/dgryski/go-rendezvous/LICENSE", 305 300 "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" ··· 503 498 "name": "github.com/golang-jwt/jwt/v5", 504 499 "path": "github.com/golang-jwt/jwt/v5/LICENSE", 505 500 "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" 506 - }, 507 - { 508 - "name": "github.com/golang-sql/civil", 509 - "path": "github.com/golang-sql/civil/LICENSE", 510 - "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." 511 - }, 512 - { 513 - "name": "github.com/golang-sql/sqlexp", 514 - "path": "github.com/golang-sql/sqlexp/LICENSE", 515 - "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" 516 501 }, 517 502 { 518 503 "name": "github.com/golang/geo",
+4 -11
cmd/doctor_convert.go
··· 17 17 var cmdDoctorConvert = &cli.Command{ 18 18 Name: "convert", 19 19 Usage: "Convert the database", 20 - Description: "A command to convert an existing MySQL database from utf8 to utf8mb4 or MSSQL database from varchar to nvarchar", 20 + Description: "A command to convert an existing MySQL database from utf8 to utf8mb4", 21 21 Action: runDoctorConvert, 22 22 } 23 23 ··· 35 35 log.Info("Log path: %s", setting.Log.RootPath) 36 36 log.Info("Configuration file: %s", setting.CustomConf) 37 37 38 - switch { 39 - case setting.Database.Type.IsMySQL(): 38 + if setting.Database.Type.IsMySQL() { 40 39 if err := db.ConvertDatabaseTable(); err != nil { 41 40 log.Fatal("Failed to convert database & table: %v", err) 42 41 return err 43 42 } 44 43 fmt.Println("Converted successfully, please confirm your database's character set is now utf8mb4") 45 - case setting.Database.Type.IsMSSQL(): 46 - if err := db.ConvertVarcharToNVarchar(); err != nil { 47 - log.Fatal("Failed to convert database from varchar to nvarchar: %v", err) 48 - return err 49 - } 50 - fmt.Println("Converted successfully, please confirm your database's all columns character is NVARCHAR now") 51 - default: 52 - fmt.Println("This command can only be used with a MySQL or MSSQL database") 44 + } else { 45 + fmt.Println("This command can only be used with a MySQL database") 53 46 } 54 47 55 48 return nil
+1 -1
cmd/dump.go
··· 128 128 &cli.StringFlag{ 129 129 Name: "database", 130 130 Aliases: []string{"d"}, 131 - Usage: "Specify the database SQL syntax: sqlite3, mysql, mssql, postgres", 131 + Usage: "Specify the database SQL syntax: sqlite3, mysql, postgres", 132 132 }, 133 133 &cli.BoolFlag{ 134 134 Name: "skip-repository",
-3
go.mod
··· 22 22 github.com/buildkite/terminal-to-html/v3 v3.10.1 23 23 github.com/caddyserver/certmagic v0.20.0 24 24 github.com/chi-middleware/proxy v1.1.1 25 - github.com/denisenkom/go-mssqldb v0.12.3 26 25 github.com/dimiro1/reply v0.0.0-20200315094148-d0136a4c9e21 27 26 github.com/djherbis/buffer v1.2.0 28 27 github.com/djherbis/nio/v3 v3.0.1 ··· 193 192 github.com/go-webauthn/x v0.1.6 // indirect 194 193 github.com/goccy/go-json v0.10.2 // indirect 195 194 github.com/golang-jwt/jwt/v4 v4.5.0 // indirect 196 - github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect 197 - github.com/golang-sql/sqlexp v0.1.0 // indirect 198 195 github.com/golang/geo v0.0.0-20230421003525-6adc56603217 // indirect 199 196 github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect 200 197 github.com/golang/protobuf v1.5.3 // indirect
-10
go.sum
··· 70 70 github.com/42wim/sshsig v0.0.0-20211121163825-841cf5bbc121/go.mod h1:Ock8XgA7pvULhIaHGAk/cDnRfNrF9Jey81nPcc403iU= 71 71 github.com/6543/go-version v1.3.1 h1:HvOp+Telns7HWJ2Xo/05YXQSB2bE0WmVgbHqwMPZT4U= 72 72 github.com/6543/go-version v1.3.1/go.mod h1:oqFAHCwtLVUTLdhQmVZWYvaHXTdsbB4SY85at64SQEo= 73 - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= 74 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.11.0/go.mod h1:HcM1YX14R7CJcghJGOYCgdezslRSVzqwLf/q+4Y2r/0= 75 - github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= 76 73 github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 h1:mFRzDkZVAjdal+s7s0MwaRv9igoPqLRdzOLzw/8Xvq8= 77 74 github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU= 78 75 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= ··· 236 233 github.com/dlclark/regexp2 v1.7.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= 237 234 github.com/dlclark/regexp2 v1.11.0 h1:G/nrcoOa7ZXlpoa/91N3X7mM3r8eIlMBBJZvsz/mxKI= 238 235 github.com/dlclark/regexp2 v1.11.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= 239 - github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= 240 236 github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5 h1:iFaUwBSo5Svw6L7HYpRu/0lE3e0BaElwnNO1qkNQxBY= 241 237 github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5/go.mod h1:qssHWj60/X5sZFNxpG4HBPDHVqxNm4DfnCKgrbZOT+s= 242 238 github.com/dsnet/golib v0.0.0-20171103203638-1ea166775780/go.mod h1:Lj+Z9rebOhdfkVLjJ8T6VcRQv3SXugXy999NBtR9aFY= ··· 376 372 github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= 377 373 github.com/golang-jwt/jwt/v5 v5.2.0 h1:d/ix8ftRUorsN+5eMIlF4T6J8CAt9rch3My2winC1Jw= 378 374 github.com/golang-jwt/jwt/v5 v5.2.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= 379 - github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= 380 375 github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 h1:au07oEsX2xN0ktxqI+Sida1w446QrXBRJ0nee3SNZlA= 381 376 github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= 382 377 github.com/golang-sql/sqlexp v0.1.0 h1:ZCD6MBpcuOVfGVqsEmY5/4FtYiKz6tSyUv9LPEDei6A= ··· 640 635 github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= 641 636 github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= 642 637 github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= 643 - github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= 644 638 github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= 645 639 github.com/mrjones/oauth v0.0.0-20180629183705-f4e24b6d100c/go.mod h1:skjdDftzkFALcuGzYSklqYd8gvat6F1gZJ4YPVbkZpM= 646 640 github.com/mrjones/oauth v0.0.0-20190623134757-126b35219450 h1:j2kD3MT1z4PXCiUllUJF9mWUESr9TWKS7iEKsQ/IipM= ··· 691 685 github.com/pierrec/lz4/v4 v4.1.21/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= 692 686 github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4= 693 687 github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI= 694 - github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA= 695 688 github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= 696 689 github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= 697 690 github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= ··· 887 880 golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 888 881 golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 889 882 golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= 890 - golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= 891 883 golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= 892 884 golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= 893 885 golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= ··· 969 961 golang.org/x/net v0.0.0-20200927032502-5d4f70055728/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= 970 962 golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= 971 963 golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= 972 - golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= 973 964 golang.org/x/net v0.0.0-20210916014120-12bc252f5db8/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= 974 965 golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= 975 966 golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= ··· 1264 1255 gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= 1265 1256 gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= 1266 1257 gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 1267 - gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 1268 1258 gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= 1269 1259 gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 1270 1260 honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
+2 -6
models/activities/user_heatmap.go
··· 39 39 // Group by 15 minute intervals which will allow the client to accurately shift the timestamp to their timezone. 40 40 // The interval is based on the fact that there are timezones such as UTC +5:30 and UTC +12:45. 41 41 groupBy := "created_unix / 900 * 900" 42 - groupByName := "timestamp" // We need this extra case because mssql doesn't allow grouping by alias 43 - switch { 44 - case setting.Database.Type.IsMySQL(): 42 + if setting.Database.Type.IsMySQL() { 45 43 groupBy = "created_unix DIV 900 * 900" 46 - case setting.Database.Type.IsMSSQL(): 47 - groupByName = groupBy 48 44 } 49 45 50 46 cond, err := activityQueryCondition(ctx, GetFeedsOptions{ ··· 67 63 Table("action"). 68 64 Where(cond). 69 65 And("created_unix > ?", timeutil.TimeStampNow()-31536000). 70 - GroupBy(groupByName). 66 + GroupBy("timestamp"). 71 67 OrderBy("timestamp"). 72 68 Find(&hdata) 73 69 }
+1 -32
models/db/collation.go
··· 41 41 return ret, nil 42 42 } 43 43 44 - func findAvailableCollationsMSSQL(x *xorm.Engine) (ret container.Set[string], err error) { 45 - var res []struct { 46 - Name string 47 - } 48 - if err = x.SQL("SELECT * FROM sys.fn_helpcollations() WHERE name LIKE '%[_]CS[_]AS%'").Find(&res); err != nil { 49 - return nil, err 50 - } 51 - ret = make(container.Set[string], len(res)) 52 - for _, r := range res { 53 - ret.Add(r.Name) 54 - } 55 - return ret, nil 56 - } 57 - 58 44 func CheckCollations(x *xorm.Engine) (*CheckCollationsResult, error) { 59 45 dbTables, err := x.DBMetas() 60 46 if err != nil { ··· 84 70 // 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. 85 71 return a == b || strings.TrimPrefix(a, "utf8mb4_") == strings.TrimPrefix(b, "utf8mb4_") 86 72 } 87 - } else if x.Dialect().URI().DBType == schemas.MSSQL { 88 - if _, err = x.SQL("SELECT DATABASEPROPERTYEX(DB_NAME(), 'Collation')").Get(&res.DatabaseCollation); err != nil { 89 - return nil, err 90 - } 91 - res.IsCollationCaseSensitive = func(s string) bool { 92 - return strings.HasSuffix(s, "_CS_AS") 93 - } 94 - candidateCollations = []string{"Latin1_General_CS_AS"} 95 - res.AvailableCollation, err = findAvailableCollationsMSSQL(x) 96 - if err != nil { 97 - return nil, err 98 - } 99 73 } else { 100 74 return nil, nil 101 75 } ··· 146 120 if x.Dialect().URI().DBType == schemas.MYSQL { 147 121 _, err := x.Exec("ALTER DATABASE CHARACTER SET utf8mb4 COLLATE " + collation) 148 122 return err 149 - } else if x.Dialect().URI().DBType == schemas.MSSQL { 150 - // TODO: MSSQL has many limitations on changing database collation, it could fail in many cases. 151 - _, err := x.Exec("ALTER DATABASE CURRENT COLLATE " + collation) 152 - return err 153 123 } 154 124 return errors.New("unsupported database type") 155 125 } ··· 165 135 } 166 136 167 137 // 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) 168 - // at the moment, there is no "altering" solution for MSSQL, site admin should manually change the database collation 138 + // at the moment. 169 139 if !r.CollationEquals(r.DatabaseCollation, r.ExpectedCollation) && r.ExistingTableNumber == 0 { 170 140 if err = alterDatabaseCollation(x, r.ExpectedCollation); err != nil { 171 141 log.Error("Failed to change database collation to %q: %v", r.ExpectedCollation, err) 172 142 } else { 173 - _, _ = x.Exec("SELECT 1") // after "altering", MSSQL's session becomes invalid, so make a simple query to "refresh" the session 174 143 if r, err = CheckCollations(x); err != nil { 175 144 log.Error("Failed to check database collation again after altering: %v", err) // impossible case 176 145 return
-2
models/db/common.go
··· 47 47 return builder.SQLITE 48 48 case setting.Database.Type.IsPostgreSQL(): 49 49 return builder.POSTGRES 50 - case setting.Database.Type.IsMSSQL(): 51 - return builder.MSSQL 52 50 default: 53 51 return "" 54 52 }
-27
models/db/convert.go
··· 47 47 return nil 48 48 } 49 49 50 - // ConvertVarcharToNVarchar converts database and tables from varchar to nvarchar if it's mssql 51 - func ConvertVarcharToNVarchar() error { 52 - if x.Dialect().URI().DBType != schemas.MSSQL { 53 - return nil 54 - } 55 - 56 - sess := x.NewSession() 57 - defer sess.Close() 58 - res, err := sess.QuerySliceString(`SELECT 'ALTER TABLE ' + OBJECT_NAME(SC.object_id) + ' MODIFY SC.name NVARCHAR(' + CONVERT(VARCHAR(5),SC.max_length) + ')' 59 - FROM SYS.columns SC 60 - JOIN SYS.types ST 61 - ON SC.system_type_id = ST.system_type_id 62 - AND SC.user_type_id = ST.user_type_id 63 - WHERE ST.name ='varchar'`) 64 - if err != nil { 65 - return err 66 - } 67 - for _, row := range res { 68 - if len(row) == 1 { 69 - if _, err = sess.Exec(row[0]); err != nil { 70 - return err 71 - } 72 - } 73 - } 74 - return err 75 - } 76 - 77 50 // Cell2Int64 converts a xorm.Cell type to int64, 78 51 // and handles possible irregular cases. 79 52 func Cell2Int64(val xorm.Cell) int64 {
+3 -6
models/db/engine.go
··· 22 22 "xorm.io/xorm/names" 23 23 "xorm.io/xorm/schemas" 24 24 25 - _ "github.com/denisenkom/go-mssqldb" // Needed for the MSSQL driver 26 - _ "github.com/go-sql-driver/mysql" // Needed for the MySQL driver 27 - _ "github.com/lib/pq" // Needed for the Postgresql driver 25 + _ "github.com/go-sql-driver/mysql" // Needed for the MySQL driver 26 + _ "github.com/lib/pq" // Needed for the Postgresql driver 28 27 ) 29 28 30 29 var ( ··· 114 113 if err != nil { 115 114 return nil, err 116 115 } 117 - if setting.Database.Type == "mysql" { 116 + if setting.Database.Type.IsMySQL() { 118 117 engine.Dialect().SetParams(map[string]string{"rowFormat": "DYNAMIC"}) 119 - } else if setting.Database.Type == "mssql" { 120 - engine.Dialect().SetParams(map[string]string{"DEFAULT_VARCHAR": "nvarchar"}) 121 118 } 122 119 engine.SetSchema(setting.Database.Schema) 123 120 return engine, nil
-29
models/db/index.go
··· 89 89 return idx, nil 90 90 } 91 91 92 - func mssqlGetNextResourceIndex(ctx context.Context, tableName string, groupID int64) (int64, error) { 93 - if _, err := GetEngine(ctx).Exec(fmt.Sprintf(` 94 - MERGE INTO %s WITH (HOLDLOCK) AS target 95 - USING (SELECT %d AS group_id) AS source 96 - (group_id) 97 - ON target.group_id = source.group_id 98 - WHEN MATCHED 99 - THEN UPDATE 100 - SET max_index = max_index + 1 101 - WHEN NOT MATCHED 102 - THEN INSERT (group_id, max_index) 103 - VALUES (%d, 1); 104 - `, tableName, groupID, groupID)); err != nil { 105 - return 0, err 106 - } 107 - 108 - var idx int64 109 - _, err := GetEngine(ctx).SQL(fmt.Sprintf("SELECT max_index FROM %s WHERE group_id = ?", tableName), groupID).Get(&idx) 110 - if err != nil { 111 - return 0, err 112 - } 113 - if idx == 0 { 114 - return 0, errors.New("cannot get the correct index") 115 - } 116 - return idx, nil 117 - } 118 - 119 92 // GetNextResourceIndex generates a resource index, it must run in the same transaction where the resource is created 120 93 func GetNextResourceIndex(ctx context.Context, tableName string, groupID int64) (int64, error) { 121 94 switch { ··· 123 96 return postgresGetNextResourceIndex(ctx, tableName, groupID) 124 97 case setting.Database.Type.IsMySQL(): 125 98 return mysqlGetNextResourceIndex(ctx, tableName, groupID) 126 - case setting.Database.Type.IsMSSQL(): 127 - return mssqlGetNextResourceIndex(ctx, tableName, groupID) 128 99 } 129 100 130 101 e := GetEngine(ctx)
+1 -1
models/git/branch.go
··· 103 103 type Branch struct { 104 104 ID int64 105 105 RepoID int64 `xorm:"UNIQUE(s)"` 106 - 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 106 + 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 107 107 CommitID string 108 108 CommitMessage string `xorm:"TEXT"` // it only stores the message summary (the first line) 109 109 PusherID int64
-30
models/git/commit_status.go
··· 84 84 return idx, nil 85 85 } 86 86 87 - func mssqlGetCommitStatusIndex(ctx context.Context, repoID int64, sha string) (int64, error) { 88 - if _, err := db.GetEngine(ctx).Exec(` 89 - MERGE INTO commit_status_index WITH (HOLDLOCK) AS target 90 - USING (SELECT ? AS repo_id, ? AS sha) AS source 91 - (repo_id, sha) 92 - ON target.repo_id = source.repo_id AND target.sha = source.sha 93 - WHEN MATCHED 94 - THEN UPDATE 95 - SET max_index = max_index + 1 96 - WHEN NOT MATCHED 97 - THEN INSERT (repo_id, sha, max_index) 98 - VALUES (?, ?, 1); 99 - `, repoID, sha, repoID, sha); err != nil { 100 - return 0, err 101 - } 102 - 103 - var idx int64 104 - _, err := db.GetEngine(ctx).SQL("SELECT max_index FROM `commit_status_index` WHERE repo_id = ? AND sha = ?", 105 - repoID, sha).Get(&idx) 106 - if err != nil { 107 - return 0, err 108 - } 109 - if idx == 0 { 110 - return 0, errors.New("cannot get the correct index") 111 - } 112 - return idx, nil 113 - } 114 - 115 87 // GetNextCommitStatusIndex retried 3 times to generate a resource index 116 88 func GetNextCommitStatusIndex(ctx context.Context, repoID int64, sha string) (int64, error) { 117 89 _, err := git.NewIDFromString(sha) ··· 124 96 return postgresGetCommitStatusIndex(ctx, repoID, sha) 125 97 case setting.Database.Type.IsMySQL(): 126 98 return mysqlGetCommitStatusIndex(ctx, repoID, sha) 127 - case setting.Database.Type.IsMSSQL(): 128 - return mssqlGetCommitStatusIndex(ctx, repoID, sha) 129 99 } 130 100 131 101 e := db.GetEngine(ctx)
-91
models/migrations/base/db.go
··· 89 89 hasID = hasID || (column.IsPrimaryKey && column.IsAutoIncrement) 90 90 } 91 91 92 - if hasID && setting.Database.Type.IsMSSQL() { 93 - if _, err := sess.Exec(fmt.Sprintf("SET IDENTITY_INSERT `%s` ON", tempTableName)); err != nil { 94 - log.Error("Unable to set identity insert for table %s. Error: %v", tempTableName, err) 95 - return err 96 - } 97 - } 98 - 99 92 sqlStringBuilder := &strings.Builder{} 100 93 _, _ = sqlStringBuilder.WriteString("INSERT INTO `") 101 94 _, _ = sqlStringBuilder.WriteString(tempTableName) ··· 141 134 if _, err := sess.Exec(sqlStringBuilder.String()); err != nil { 142 135 log.Error("Unable to set copy data in to temp table %s. Error: %v", tempTableName, err) 143 136 return err 144 - } 145 - 146 - if hasID && setting.Database.Type.IsMSSQL() { 147 - if _, err := sess.Exec(fmt.Sprintf("SET IDENTITY_INSERT `%s` OFF", tempTableName)); err != nil { 148 - log.Error("Unable to switch off identity insert for table %s. Error: %v", tempTableName, err) 149 - return err 150 - } 151 137 } 152 138 153 139 switch { ··· 296 282 297 283 } 298 284 299 - case setting.Database.Type.IsMSSQL(): 300 - // MSSQL will drop all the constraints on the old table 301 - if _, err := sess.Exec(fmt.Sprintf("DROP TABLE `%s`", tableName)); err != nil { 302 - log.Error("Unable to drop old table %s. Error: %v", tableName, err) 303 - return err 304 - } 305 - 306 - // MSSQL sp_rename will move all the constraints from the temporary table to the new table 307 - if _, err := sess.Exec(fmt.Sprintf("sp_rename `%s`,`%s`", tempTableName, tableName)); err != nil { 308 - log.Error("Unable to rename %s to %s. Error: %v", tempTableName, tableName, err) 309 - return err 310 - } 311 - 312 285 default: 313 286 log.Fatal("Unrecognized DB") 314 287 } ··· 444 417 if _, err := sess.Exec(fmt.Sprintf("ALTER TABLE `%s` %s", tableName, cols)); err != nil { 445 418 return fmt.Errorf("Drop table `%s` columns %v: %v", tableName, columnNames, err) 446 419 } 447 - case setting.Database.Type.IsMSSQL(): 448 - cols := "" 449 - for _, col := range columnNames { 450 - if cols != "" { 451 - cols += ", " 452 - } 453 - cols += "`" + strings.ToLower(col) + "`" 454 - } 455 - 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'))", 456 - tableName, strings.ReplaceAll(cols, "`", "'")) 457 - constraints := make([]string, 0) 458 - if err := sess.SQL(sql).Find(&constraints); err != nil { 459 - return fmt.Errorf("Find constraints: %v", err) 460 - } 461 - for _, constraint := range constraints { 462 - if _, err := sess.Exec(fmt.Sprintf("ALTER TABLE `%s` DROP CONSTRAINT `%s`", tableName, constraint)); err != nil { 463 - return fmt.Errorf("Drop table `%s` default constraint `%s`: %v", tableName, constraint, err) 464 - } 465 - } 466 - 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'))", 467 - tableName, strings.ReplaceAll(cols, "`", "'")) 468 - constraints = make([]string, 0) 469 - if err := sess.SQL(sql).Find(&constraints); err != nil { 470 - return fmt.Errorf("Find constraints: %v", err) 471 - } 472 - for _, constraint := range constraints { 473 - if _, err := sess.Exec(fmt.Sprintf("DROP INDEX `%[2]s` ON `%[1]s`", tableName, constraint)); err != nil { 474 - return fmt.Errorf("Drop index `%[2]s` on `%[1]s`: %v", tableName, constraint, err) 475 - } 476 - } 477 - 478 - if _, err := sess.Exec(fmt.Sprintf("ALTER TABLE `%s` DROP COLUMN %s", tableName, cols)); err != nil { 479 - return fmt.Errorf("Drop table `%s` columns %v: %v", tableName, columnNames, err) 480 - } 481 420 default: 482 421 log.Fatal("Unrecognized DB") 483 422 } ··· 489 428 func ModifyColumn(x *xorm.Engine, tableName string, col *schemas.Column) error { 490 429 var indexes map[string]*schemas.Index 491 430 var err error 492 - // MSSQL have to remove index at first, otherwise alter column will fail 493 - // 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/ 494 - if x.Dialect().URI().DBType == schemas.MSSQL { 495 - indexes, err = x.Dialect().GetIndexes(x.DB(), context.Background(), tableName) 496 - if err != nil { 497 - return err 498 - } 499 - 500 - for _, index := range indexes { 501 - _, err = x.Exec(x.Dialect().DropIndexSQL(tableName, index)) 502 - if err != nil { 503 - return err 504 - } 505 - } 506 - } 507 431 508 432 defer func() { 509 433 for _, index := range indexes { ··· 611 535 return err 612 536 } 613 537 return nil 614 - } 615 - case setting.Database.Type.IsMSSQL(): 616 - host, port := setting.ParseMSSQLHostPort(setting.Database.Host) 617 - db, err := sql.Open("mssql", fmt.Sprintf("server=%s; port=%s; database=%s; user id=%s; password=%s;", 618 - host, port, "master", setting.Database.User, setting.Database.Passwd)) 619 - if err != nil { 620 - return err 621 - } 622 - defer db.Close() 623 - 624 - if _, err = db.Exec(fmt.Sprintf("DROP DATABASE IF EXISTS [%s]", setting.Database.Name)); err != nil { 625 - return err 626 - } 627 - if _, err = db.Exec(fmt.Sprintf("CREATE DATABASE [%s]", setting.Database.Name)); err != nil { 628 - return err 629 538 } 630 539 } 631 540
-3
models/migrations/v1_11/v110.go
··· 16 16 case schemas.ORACLE: 17 17 _, err := x.Exec("ALTER TABLE review MODIFY content TEXT") 18 18 return err 19 - case schemas.MSSQL: 20 - _, err := x.Exec("ALTER TABLE review ALTER COLUMN content TEXT") 21 - return err 22 19 case schemas.POSTGRES: 23 20 _, err := x.Exec("ALTER TABLE review ALTER COLUMN content TYPE TEXT") 24 21 return err
+2 -5
models/migrations/v1_12/v139.go
··· 12 12 func PrependRefsHeadsToIssueRefs(x *xorm.Engine) error { 13 13 var query string 14 14 15 - switch { 16 - case setting.Database.Type.IsMSSQL(): 17 - query = "UPDATE `issue` SET `ref` = 'refs/heads/' + `ref` WHERE `ref` IS NOT NULL AND `ref` <> '' AND `ref` NOT LIKE 'refs/%'" 18 - case setting.Database.Type.IsMySQL(): 15 + if setting.Database.Type.IsMySQL() { 19 16 query = "UPDATE `issue` SET `ref` = CONCAT('refs/heads/', `ref`) WHERE `ref` IS NOT NULL AND `ref` <> '' AND `ref` NOT LIKE 'refs/%';" 20 - default: 17 + } else { 21 18 query = "UPDATE `issue` SET `ref` = 'refs/heads/' || `ref` WHERE `ref` IS NOT NULL AND `ref` <> '' AND `ref` NOT LIKE 'refs/%'" 22 19 } 23 20
-26
models/migrations/v1_13/v145.go
··· 45 45 if _, err := sess.Exec(fmt.Sprintf("ALTER TABLE language_stat MODIFY COLUMN language %s", sqlType)); err != nil { 46 46 return err 47 47 } 48 - case setting.Database.Type.IsMSSQL(): 49 - // Yet again MSSQL just has to be awkward. 50 - // Here we have to drop the constraints first and then rebuild them 51 - constraints := make([]string, 0) 52 - if err := sess.SQL(`SELECT i.name AS Name 53 - FROM sys.indexes i INNER JOIN sys.index_columns ic 54 - ON i.index_id = ic.index_id AND i.object_id = ic.object_id 55 - INNER JOIN sys.tables AS t 56 - ON t.object_id = i.object_id 57 - INNER JOIN sys.columns c 58 - ON t.object_id = c.object_id AND ic.column_id = c.column_id 59 - WHERE t.name = 'language_stat' AND c.name = 'language'`).Find(&constraints); err != nil { 60 - return fmt.Errorf("Find constraints: %w", err) 61 - } 62 - for _, constraint := range constraints { 63 - if _, err := sess.Exec(fmt.Sprintf("DROP INDEX [%s] ON `language_stat`", constraint)); err != nil { 64 - return fmt.Errorf("Drop table `language_stat` constraint `%s`: %w", constraint, err) 65 - } 66 - } 67 - if _, err := sess.Exec(fmt.Sprintf("ALTER TABLE language_stat ALTER COLUMN language %s", sqlType)); err != nil { 68 - return err 69 - } 70 - // Finally restore the constraint 71 - if err := sess.CreateUniques(new(LanguageStat)); err != nil { 72 - return err 73 - } 74 48 case setting.Database.Type.IsPostgreSQL(): 75 49 if _, err := sess.Exec(fmt.Sprintf("ALTER TABLE language_stat ALTER COLUMN language TYPE %s", sqlType)); err != nil { 76 50 return err
-30
models/migrations/v1_13/v151.go
··· 23 23 case setting.Database.Type.IsPostgreSQL(): 24 24 _, err := x.Exec("ALTER TABLE `user` ALTER COLUMN passwd_hash_algo SET DEFAULT 'argon2';") 25 25 return err 26 - case setting.Database.Type.IsMSSQL(): 27 - // need to find the constraint and drop it, then recreate it. 28 - sess := x.NewSession() 29 - defer sess.Close() 30 - if err := sess.Begin(); err != nil { 31 - return err 32 - } 33 - 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") 34 - if err != nil { 35 - return err 36 - } 37 - if len(res) > 0 { 38 - constraintName := res[0]["name"] 39 - log.Error("Results of select constraint: %s", constraintName) 40 - _, err := sess.Exec("ALTER TABLE [user] DROP CONSTRAINT " + constraintName) 41 - if err != nil { 42 - return err 43 - } 44 - _, err = sess.Exec("ALTER TABLE [user] ADD CONSTRAINT " + constraintName + " DEFAULT 'argon2' FOR passwd_hash_algo") 45 - if err != nil { 46 - return err 47 - } 48 - } else { 49 - _, err := sess.Exec("ALTER TABLE [user] ADD DEFAULT('argon2') FOR passwd_hash_algo") 50 - if err != nil { 51 - return err 52 - } 53 - } 54 - return sess.Commit() 55 - 56 26 case setting.Database.Type.IsSQLite3(): 57 27 // drop through 58 28 default:
-10
models/migrations/v1_14/v158.go
··· 62 62 return err 63 63 } 64 64 65 - if setting.Database.Type.IsMSSQL() { 66 - if _, err := sess.Exec(sqlSelect + " INTO #temp_comments" + sqlTail); err != nil { 67 - log.Error("unable to create temporary table") 68 - return err 69 - } 70 - } 71 - 72 65 comments := make([]*Comment, 0, batchSize) 73 66 74 67 switch { ··· 78 71 fallthrough 79 72 case setting.Database.Type.IsSQLite3(): 80 73 sqlCmd = sqlSelect + sqlTail + " LIMIT " + strconv.Itoa(batchSize) + " OFFSET " + strconv.Itoa(start) 81 - case setting.Database.Type.IsMSSQL(): 82 - sqlCmd = "SELECT TOP " + strconv.Itoa(batchSize) + " * FROM #temp_comments WHERE " + 83 - "(id NOT IN ( SELECT TOP " + strconv.Itoa(start) + " id FROM #temp_comments ORDER BY id )) ORDER BY id" 84 74 default: 85 75 return fmt.Errorf("Unsupported database type") 86 76 }
+2 -14
models/migrations/v1_14/v165.go
··· 32 32 return err 33 33 } 34 34 35 - var hookTaskTrimSQL string 36 - if dbType == schemas.MSSQL { 37 - hookTaskTrimSQL = "UPDATE hook_task SET typ = RTRIM(LTRIM(typ))" 38 - } else { 39 - hookTaskTrimSQL = "UPDATE hook_task SET typ = TRIM(typ)" 40 - } 41 - if _, err := x.Exec(hookTaskTrimSQL); err != nil { 35 + if _, err := x.Exec("UPDATE hook_task SET typ = TRIM(typ)"); err != nil { 42 36 return err 43 37 } 44 38 ··· 58 52 return err 59 53 } 60 54 61 - var webhookTrimSQL string 62 - if dbType == schemas.MSSQL { 63 - webhookTrimSQL = "UPDATE webhook SET type = RTRIM(LTRIM(type))" 64 - } else { 65 - webhookTrimSQL = "UPDATE webhook SET type = TRIM(type)" 66 - } 67 - _, err := x.Exec(webhookTrimSQL) 55 + _, err := x.Exec("UPDATE webhook SET type = TRIM(type)") 68 56 return err 69 57 }
+2 -7
models/migrations/v1_15/v184.go
··· 53 53 } 54 54 } 55 55 56 - switch { 57 - case setting.Database.Type.IsMySQL(): 56 + if setting.Database.Type.IsMySQL() { 58 57 if _, err := sess.Exec("ALTER TABLE `task` CHANGE errors message text"); err != nil { 59 58 return err 60 59 } 61 - case setting.Database.Type.IsMSSQL(): 62 - if _, err := sess.Exec("sp_rename 'task.errors', 'message', 'COLUMN'"); err != nil { 63 - return err 64 - } 65 - default: 60 + } else { 66 61 if _, err := sess.Exec("ALTER TABLE `task` RENAME COLUMN errors TO message"); err != nil { 67 62 return err 68 63 }
-26
models/migrations/v1_16/v210.go
··· 8 8 "fmt" 9 9 "strings" 10 10 11 - "code.gitea.io/gitea/models/migrations/base" 12 11 "code.gitea.io/gitea/modules/timeutil" 13 12 14 13 "github.com/tstranex/u2f" ··· 48 47 if err != nil { 49 48 return err 50 49 } 51 - case schemas.MSSQL: 52 - // This column has an index on it. I could write all of the code to attempt to change the index OR 53 - // I could just use recreate table. 54 - sess := x.NewSession() 55 - if err := sess.Begin(); err != nil { 56 - _ = sess.Close() 57 - return err 58 - } 59 - 60 - if err := base.RecreateTable(sess, new(webauthnCredential)); err != nil { 61 - _ = sess.Close() 62 - return err 63 - } 64 - if err := sess.Commit(); err != nil { 65 - _ = sess.Close() 66 - return err 67 - } 68 - if err := sess.Close(); err != nil { 69 - return err 70 - } 71 50 case schemas.POSTGRES: 72 51 _, err := x.Exec("ALTER TABLE webauthn_credential ALTER COLUMN credential_id TYPE VARCHAR(410)") 73 52 if err != nil { ··· 110 89 defer sess.Close() 111 90 if err := sess.Begin(); err != nil { 112 91 return fmt.Errorf("unable to allow start session. Error: %w", err) 113 - } 114 - if x.Dialect().URI().DBType == schemas.MSSQL { 115 - if _, err := sess.Exec("SET IDENTITY_INSERT `webauthn_credential` ON"); err != nil { 116 - return fmt.Errorf("unable to allow identity insert on webauthn_credential. Error: %w", err) 117 - } 118 92 } 119 93 for _, reg := range regs { 120 94 parsed := new(u2f.Registration)
+2 -6
models/migrations/v1_17/v220.go
··· 12 12 ) 13 13 14 14 func AddContainerRepositoryProperty(x *xorm.Engine) (err error) { 15 - switch x.Dialect().URI().DBType { 16 - case schemas.SQLITE: 15 + if x.Dialect().URI().DBType == schemas.SQLITE { 17 16 _, err = x.Exec("INSERT INTO package_property (ref_type, ref_id, name, value) SELECT ?, p.id, ?, u.lower_name || '/' || p.lower_name FROM package p JOIN `user` u ON p.owner_id = u.id WHERE p.type = ?", 18 17 packages_model.PropertyTypePackage, container_module.PropertyRepository, packages_model.TypeContainer) 19 - case schemas.MSSQL: 20 - _, err = x.Exec("INSERT INTO package_property (ref_type, ref_id, name, value) SELECT ?, p.id, ?, u.lower_name + '/' + p.lower_name FROM package p JOIN `user` u ON p.owner_id = u.id WHERE p.type = ?", 21 - packages_model.PropertyTypePackage, container_module.PropertyRepository, packages_model.TypeContainer) 22 - default: 18 + } else { 23 19 _, err = x.Exec("INSERT INTO package_property (ref_type, ref_id, name, value) SELECT ?, p.id, ?, CONCAT(u.lower_name, '/', p.lower_name) FROM package p JOIN `user` u ON p.owner_id = u.id WHERE p.type = ?", 24 20 packages_model.PropertyTypePackage, container_module.PropertyRepository, packages_model.TypeContainer) 25 21 }
+2 -7
models/migrations/v1_17/v223.go
··· 64 64 } 65 65 } 66 66 67 - switch { 68 - case setting.Database.Type.IsMySQL(): 67 + if setting.Database.Type.IsMySQL() { 69 68 if _, err := sess.Exec("ALTER TABLE `webauthn_credential` CHANGE credential_id_bytes credential_id VARBINARY(1024)"); err != nil { 70 69 return err 71 70 } 72 - case setting.Database.Type.IsMSSQL(): 73 - if _, err := sess.Exec("sp_rename 'webauthn_credential.credential_id_bytes', 'credential_id', 'COLUMN'"); err != nil { 74 - return err 75 - } 76 - default: 71 + } else { 77 72 if _, err := sess.Exec("ALTER TABLE `webauthn_credential` RENAME COLUMN credential_id_bytes TO credential_id"); err != nil { 78 73 return err 79 74 }
+2 -7
models/migrations/v1_20/v245.go
··· 50 50 } 51 51 } 52 52 53 - switch { 54 - case setting.Database.Type.IsMySQL(): 53 + if setting.Database.Type.IsMySQL() { 55 54 inferredTable, err := x.TableInfo(new(Webhook)) 56 55 if err != nil { 57 56 return err ··· 60 59 if _, err := sess.Exec(fmt.Sprintf("ALTER TABLE `webhook` CHANGE org_id owner_id %s", sqlType)); err != nil { 61 60 return err 62 61 } 63 - case setting.Database.Type.IsMSSQL(): 64 - if _, err := sess.Exec("sp_rename 'webhook.org_id', 'owner_id', 'COLUMN'"); err != nil { 65 - return err 66 - } 67 - default: 62 + } else { 68 63 if _, err := sess.Exec("ALTER TABLE `webhook` RENAME COLUMN org_id TO owner_id"); err != nil { 69 64 return err 70 65 }
+6 -15
models/migrations/v1_22/v283.go
··· 4 4 package v1_22 //nolint 5 5 6 6 import ( 7 - "fmt" 8 - 9 7 "xorm.io/xorm" 10 - "xorm.io/xorm/schemas" 11 8 ) 12 9 13 10 func AddCombinedIndexToIssueUser(x *xorm.Engine) error { ··· 23 20 return err 24 21 } 25 22 for _, issueUser := range duplicatedIssueUsers { 26 - if x.Dialect().URI().DBType == schemas.MSSQL { 27 - 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 { 28 - return err 29 - } 30 - } else { 31 - var ids []int64 32 - 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 { 33 - return err 34 - } 35 - if _, err := x.Table("issue_user").In("id", ids).Delete(); err != nil { 36 - return err 37 - } 23 + var ids []int64 24 + 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 { 25 + return err 26 + } 27 + if _, err := x.Table("issue_user").In("id", ids).Delete(); err != nil { 28 + return err 38 29 } 39 30 } 40 31
-32
models/migrations/v1_22/v286.go
··· 3 3 package v1_22 //nolint 4 4 5 5 import ( 6 - "errors" 7 6 "fmt" 8 7 9 8 "code.gitea.io/gitea/modules/log" ··· 33 32 } 34 33 35 34 if !setting.Database.Type.IsSQLite3() { 36 - if setting.Database.Type.IsMSSQL() { 37 - // drop indexes that need to be re-created afterwards 38 - droppedIndexes := []string{ 39 - "DROP INDEX IF EXISTS [IDX_commit_status_context_hash] ON [commit_status]", 40 - "DROP INDEX IF EXISTS [UQE_review_state_pull_commit_user] ON [review_state]", 41 - "DROP INDEX IF EXISTS [UQE_repo_archiver_s] ON [repo_archiver]", 42 - } 43 - for _, s := range droppedIndexes { 44 - _, err := db.Exec(s) 45 - if err != nil { 46 - return errors.New(s + " " + err.Error()) 47 - } 48 - } 49 - } 50 - 51 35 for _, alts := range alteredTables { 52 36 var err error 53 37 if setting.Database.Type.IsMySQL() { 54 38 _, err = db.Exec(fmt.Sprintf("ALTER TABLE `%s` MODIFY COLUMN `%s` VARCHAR(64)", alts[0], alts[1])) 55 - } else if setting.Database.Type.IsMSSQL() { 56 - _, err = db.Exec(fmt.Sprintf("ALTER TABLE [%s] ALTER COLUMN [%s] VARCHAR(64)", alts[0], alts[1])) 57 39 } else { 58 40 _, err = db.Exec(fmt.Sprintf("ALTER TABLE `%s` ALTER COLUMN `%s` TYPE VARCHAR(64)", alts[0], alts[1])) 59 41 } 60 42 if err != nil { 61 43 return fmt.Errorf("alter column '%s' of table '%s' failed: %w", alts[1], alts[0], err) 62 - } 63 - } 64 - 65 - if setting.Database.Type.IsMSSQL() { 66 - recreateIndexes := []string{ 67 - "CREATE INDEX IDX_commit_status_context_hash ON commit_status(context_hash)", 68 - "CREATE UNIQUE INDEX UQE_review_state_pull_commit_user ON review_state(user_id, pull_id, commit_sha)", 69 - "CREATE UNIQUE INDEX UQE_repo_archiver_s ON repo_archiver(repo_id, type, commit_id)", 70 - } 71 - for _, s := range recreateIndexes { 72 - _, err := db.Exec(s) 73 - if err != nil { 74 - return errors.New(s + " " + err.Error()) 75 - } 76 44 } 77 45 } 78 46 }
-2
models/migrations/v1_8/v81.go
··· 18 18 _, err = x.Exec("ALTER TABLE `u2f_registration` MODIFY `counter` BIGINT") 19 19 case schemas.POSTGRES: 20 20 _, err = x.Exec("ALTER TABLE `u2f_registration` ALTER COLUMN `counter` SET DATA TYPE bigint") 21 - case schemas.MSSQL: 22 - _, err = x.Exec("ALTER TABLE `u2f_registration` ALTER COLUMN `counter` BIGINT") 23 21 } 24 22 25 23 if err != nil {
-2
models/unittest/fixtures.go
··· 60 60 dialect = "postgres" 61 61 case schemas.MYSQL: 62 62 dialect = "mysql" 63 - case schemas.MSSQL: 64 - dialect = "mssql" 65 63 case schemas.SQLITE: 66 64 dialect = "sqlite3" 67 65 default:
+2 -31
modules/setting/database.go
··· 16 16 17 17 var ( 18 18 // SupportedDatabaseTypes includes all XORM supported databases type, sqlite3 maybe added by `database_sqlite3.go` 19 - SupportedDatabaseTypes = []string{"mysql", "postgres", "mssql"} 19 + SupportedDatabaseTypes = []string{"mysql", "postgres"} 20 20 // DatabaseTypeNames contains the friendly names for all database types 21 - DatabaseTypeNames = map[string]string{"mysql": "MySQL", "postgres": "PostgreSQL", "mssql": "MSSQL", "sqlite3": "SQLite3"} 21 + DatabaseTypeNames = map[string]string{"mysql": "MySQL", "postgres": "PostgreSQL", "sqlite3": "SQLite3"} 22 22 23 23 // EnableSQLite3 use SQLite3, set by build flag 24 24 EnableSQLite3 bool ··· 120 120 Database.User, Database.Passwd, connType, Database.Host, Database.Name, paramSep, tls) 121 121 case "postgres": 122 122 connStr = getPostgreSQLConnectionString(Database.Host, Database.User, Database.Passwd, Database.Name, Database.SSLMode) 123 - case "mssql": 124 - host, port := ParseMSSQLHostPort(Database.Host) 125 - connStr = fmt.Sprintf("server=%s; port=%s; database=%s; user id=%s; password=%s;", host, port, Database.Name, Database.User, Database.Passwd) 126 123 case "sqlite3": 127 124 if !EnableSQLite3 { 128 125 return "", errors.New("this Gitea binary was not built with SQLite3 support") ··· 188 185 return connURL.String() 189 186 } 190 187 191 - // ParseMSSQLHostPort splits the host into host and port 192 - func ParseMSSQLHostPort(info string) (string, string) { 193 - // the default port "0" might be related to MSSQL's dynamic port, maybe it should be double-confirmed in the future 194 - host, port := "127.0.0.1", "0" 195 - if strings.Contains(info, ":") { 196 - host = strings.Split(info, ":")[0] 197 - port = strings.Split(info, ":")[1] 198 - } else if strings.Contains(info, ",") { 199 - host = strings.Split(info, ",")[0] 200 - port = strings.TrimSpace(strings.Split(info, ",")[1]) 201 - } else if len(info) > 0 { 202 - host = info 203 - } 204 - if host == "" { 205 - host = "127.0.0.1" 206 - } 207 - if port == "" { 208 - port = "0" 209 - } 210 - return host, port 211 - } 212 - 213 188 type DatabaseType string 214 189 215 190 func (t DatabaseType) String() string { ··· 222 197 223 198 func (t DatabaseType) IsMySQL() bool { 224 199 return t == "mysql" 225 - } 226 - 227 - func (t DatabaseType) IsMSSQL() bool { 228 - return t == "mssql" 229 200 } 230 201 231 202 func (t DatabaseType) IsPostgreSQL() bool {
+1 -2
options/locale/locale_ar.ini
··· 137 137 db_schema = مخطط 138 138 reinstall_error = أنت تحاول التثبيت في قاعدة بيانات فورجيو موجودة 139 139 sqlite_helper = مسار المِلَفّ لقاعدة بيانات SQLite3.<br>أدخل المسار المطلق إذا شغلت فورجيو كخدمة. 140 - require_db_desc = فورجيو يحتاج MySQL أو PostgreSQL أو MSSQL أو SQLite3 أو TiDB. 140 + require_db_desc = فورجيو يحتاج MySQL أو PostgreSQL أو SQLite3 أو TiDB. 141 141 password = كلمة المرور 142 142 host = المضيف 143 143 docker_helper = إذا كنت تستخدم فورجيو داخل دوكر، يرجي قراءة <a target="_blank" rel="noopener noreferrer" href="%s">المستندات</a> قبل تغيير أي إعدادات. ··· 1547 1547 dashboard.sync_repo_tags = زامن الوسوم من بيانات جِت إلى قاعدة البيانات 1548 1548 self_check = فحص ذاتي 1549 1549 self_check.database_collation_case_insensitive = تستخدم قاعدة البيانات تجميع %s ، وهو تجميع غير حساس. على الرغم من أن فورجيو يمكن أن يعمل معها قد تكون هناك حالات نادرة لا تعمل كما هو متوقع. 1550 - self_check.database_fix_mssql = بالنسبة لمستخدمي الـإم إس سيكول، يمكنك إصلاح المشكلة بتعديل السيكول يدوياً فقط في الوقت الراهن. 1551 1550 monitor.process.cancel_desc = قد يسبب إلغاء العملية فقدانًا للبيانات 1552 1551 monitor.queue.type = النوع 1553 1552 monitor.process.cancel_notices = أتريد إلغاء: <strong>%s</strong>؟
+1 -1
options/locale/locale_bg.ini
··· 1217 1217 confirm_password = Потвърдете паролата 1218 1218 title = Първоначална конфигурация 1219 1219 domain = Домейн на сървъра 1220 - require_db_desc = Forgejo изисква MySQL, PostgreSQL, MSSQL, SQLite3 или TiDB (MySQL протокол). 1220 + require_db_desc = Forgejo изисква MySQL, PostgreSQL, SQLite3 или TiDB (MySQL протокол). 1221 1221 general_title = Общи настройки 1222 1222 email_title = Настройки на ел. поща 1223 1223 db_schema = Схема
+1 -3
options/locale/locale_cs-CZ.ini
··· 219 219 install=Instalace 220 220 title=Počáteční konfigurace 221 221 docker_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í. 222 - require_db_desc=Forgejo vyžaduje MySQL, PostgreSQL, MSSQL, SQLite3 nebo TiDB (protokol MySQL). 222 + require_db_desc=Forgejo vyžaduje MySQL, PostgreSQL, SQLite3 nebo TiDB (protokol MySQL). 223 223 db_title=Nastavení databáze 224 224 db_type=Typ databáze 225 225 host=Hostitel ··· 3396 3396 dashboard.sync_tag.started = Synchronizace značek spuštěna 3397 3397 dashboard.rebuild_issue_indexer = Přestavit indexer vydání 3398 3398 self_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á. 3399 - self_check.database_fix_mssql = Uživatelé MSSQL mohou tento problém vyřešit pouze ručními SQL příkazy „ALTER ... COLLATE ...“. 3400 3399 auths.oauth2_map_group_to_team = Zmapovat zabrané skupiny u týmů organizací (volitelné - vyžaduje název claimu výše) 3401 3400 monitor.queue.settings.desc = Pooly dynamicky rostou podle blokování fronty jejich workerů. 3402 3401 ··· 3405 3404 self_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í. 3406 3405 self_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. 3407 3406 self_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ě. 3408 - self_check.database_fix_mssql=Uživatelé MSSQL mohou problém vyřešit pouze pomocí příkazu "ALTER ... COLLATE ..." SQL ručně. 3409 3407 auths.tips.gmail_settings = Nastavení služby Gmail: 3410 3408 config_summary = Souhrn 3411 3409 config.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
··· 217 217 install=Installation 218 218 title=Erstkonfiguration 219 219 docker_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. 220 - require_db_desc=Forgejo benötigt MySQL, PostgreSQL, MSSQL, SQLite3 oder TiDB (MySQL-Protokoll). 220 + require_db_desc=Forgejo benötigt MySQL, PostgreSQL, SQLite3 oder TiDB (MySQL-Protokoll). 221 221 db_title=Datenbankeinstellungen 222 222 db_type=Datenbanktyp 223 223 host=Host ··· 3368 3368 dashboard.sync_repo_tags = Tags aus Git-Daten zu Datenbank synchronisieren 3369 3369 emails.change_email_text = Bist du dir sicher, dass du diese E-Mail-Addresse aktualisieren möchtest? 3370 3370 packages.cleanup.success = Abgelaufene Daten erfolgreich gesäubert 3371 - self_check.database_fix_mssql = Für MSSQL-Benutzer: Du kannst das Problem im Moment nur mit „ALTER … COLLATE …“-SQLs beheben. 3372 3371 self_check.no_problem_found = Noch kein Problem gefunden. 3373 3372 self_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. 3374 3373 self_check.database_collation_mismatch = Erwarte von Datenbank, folgende Collation zu verwenden: %s
+1 -2
options/locale/locale_el-GR.ini
··· 211 211 install=Εγκατάσταση 212 212 title=Αρχικές ρυθμίσεις 213 213 docker_helper=Αν εκτελέσετε το Forgejo μέσα στο Docker, παρακαλώ διαβάστε το <a target="_blank" rel="noopener noreferrer" href="%s">εγχειρίδιο</a> πριν αλλάξετε τις ρυθμίσεις. 214 - require_db_desc=Το Forgejo απαιτεί MySQL, PostgreSQL, MSSQL, SQLite3 ή TiDB (με πρωτόκολλο MySQL). 214 + require_db_desc=Το Forgejo απαιτεί MySQL, PostgreSQL, SQLite3 ή TiDB (με πρωτόκολλο MySQL). 215 215 db_title=Ρυθμίσεις βάσης δεδομένων 216 216 db_type=Είδος βάσης δεδομένων 217 217 host=Διακομιστής ··· 3322 3322 notices.op=Λειτ. 3323 3323 notices.delete_success=Οι ειδοποιήσεις του συστήματος έχουν διαγραφεί. 3324 3324 self_check.no_problem_found = Μέχρι τώρα, δεν έχει βρεθεί κάποιο πρόβλημα. 3325 - self_check.database_fix_mssql = Προς το παρόν, οι χρήστες του MSSQL μπορούν να διορθώσουν το πρόβλημα αυτό χειροκίνητα χρησιμοποιώντας τις εντολές SQL «ALTER ... COLLATE ...». 3326 3325 self_check = Αυτοέλεγχος 3327 3326 dashboard.sync_repo_tags = Συγχρονισμός tag από δεδομένα git στην βάση δεδομένων 3328 3327 dashboard.sync_tag.started = Ο συγχρονισμός tag έχει ξεκινήσει
+1 -2
options/locale/locale_en-US.ini
··· 239 239 install = Installation 240 240 title = Initial configuration 241 241 docker_helper = If you run Forgejo inside Docker, please read the <a target="_blank" rel="noopener noreferrer" href="%s">documentation</a> before changing any settings. 242 - require_db_desc = Forgejo requires MySQL, PostgreSQL, MSSQL, SQLite3 or TiDB (MySQL protocol). 242 + require_db_desc = Forgejo requires MySQL, PostgreSQL, SQLite3 or TiDB (MySQL protocol). 243 243 db_title = Database settings 244 244 db_type = Database type 245 245 host = Host ··· 3378 3378 self_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. 3379 3379 self_check.database_inconsistent_collation_columns = Database is using collation %s, but these columns are using mismatched collations. It might cause some unexpected problems. 3380 3380 self_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. 3381 - self_check.database_fix_mssql = For MSSQL users, you could only fix the problem by "ALTER ... COLLATE ..." SQLs manually at the moment. 3382 3381 3383 3382 [action] 3384 3383 create_repo = created repository <a href="%s">%s</a>
+1 -1
options/locale/locale_eo.ini
··· 226 226 repo_path_helper = Foraj Git-deponejoj konserviĝos al tiu ĉi dosierujo. 227 227 sqlite_helper = Dosiervojo por la datumbazo SQLite3.<br>Enigu absolutan vojon se vi rulas Forgejon kiel servo. 228 228 enable_captcha = Ŝalti dumregistriĝan teston de homeco 229 - require_db_desc = Forgejo bezonas kiel datumbazo MySQL, PostgreSQL, MSSQL, SQLite3, aŭ TiDB (MySQL komunikformo). 229 + require_db_desc = Forgejo bezonas kiel datumbazo MySQL, PostgreSQL, SQLite3, aŭ TiDB (MySQL komunikformo). 230 230 smtp_from = Sendu retleterojn kiel 231 231 general_title = Ĝeneralaj agordoj 232 232 password = Pasvorto
+1 -1
options/locale/locale_es-ES.ini
··· 210 210 install=Instalación 211 211 title=Configuración inicial 212 212 docker_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. 213 - require_db_desc=Forgejo requiere una base de datos MySQL, PostgreSQL, MSSQL, SQLite3 o TiDB (usar el protocolo MySQL). 213 + require_db_desc=Forgejo requiere una base de datos MySQL, PostgreSQL, SQLite3 o TiDB (usar el protocolo MySQL). 214 214 db_title=Configuración de base de datos 215 215 db_type=Tipo de base de datos 216 216 host=Servidor
+1 -1
options/locale/locale_fi-FI.ini
··· 144 144 install=Asennus 145 145 title=Alkuperäiset asetukset 146 146 docker_helper=Jos ajat Forgejoa Dockerin sisällä, lue <a target="_blank" rel="noopener noreferrer" href="%s">ohjeet</a> ennen minkään asetuksen muuttamista. 147 - require_db_desc=Forgejo tarvitsee toimiakseen MySQL, PostgreSQL, MSSQL, SQLite3 tai TiDB (MySQL protokolla) tietokannan. 147 + require_db_desc=Forgejo tarvitsee toimiakseen MySQL, PostgreSQL, SQLite3 tai TiDB (MySQL protokolla) tietokannan. 148 148 db_title=Tietokanta asetukset 149 149 db_type=Tietokanta tyyppi 150 150 host=Isäntä
+1 -1
options/locale/locale_fil.ini
··· 211 211 install = Pag-install 212 212 title = Paunang pagsasaayos 213 213 docker_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. 214 - require_db_desc = Kinakailangan ng Forgejo ang MySQL, PostgreSQL, MSSQL, SQLite3 o TiDB (MySQL protocol). 214 + require_db_desc = Kinakailangan ng Forgejo ang MySQL, PostgreSQL, SQLite3 o TiDB (MySQL protocol). 215 215 db_title = Mga setting ng database 216 216 db_type = Uri ng database 217 217 host = Host
+1 -3
options/locale/locale_fr-FR.ini
··· 218 218 install=Installation 219 219 title=Configuration initiale 220 220 docker_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. 221 - require_db_desc=Forgejo nécessite MySQL, PostgreSQL, MSSQL, SQLite3 ou TiDB (avec le protocole MySQL). 221 + require_db_desc=Forgejo nécessite MySQL, PostgreSQL, SQLite3 ou TiDB (avec le protocole MySQL). 222 222 db_title=Paramètres de la base de données 223 223 db_type=Type de base de données 224 224 host=Hôte ··· 3388 3388 self_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. 3389 3389 self_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. 3390 3390 self_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 ...". 3391 - 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. 3392 3391 3393 3392 self_check.no_problem_found=Aucun problème trouvé pour l’instant. 3394 3393 self_check.database_collation_mismatch=Exige que la base de données utilise la collation %s. 3395 3394 self_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. 3396 3395 self_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. 3397 3396 self_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. 3398 - 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 … ». 3399 3397 3400 3398 [action] 3401 3399 create_repo=a créé le dépôt <a href="%s">%s</a>
+1 -1
options/locale/locale_is-IS.ini
··· 141 141 install=Uppsetning 142 142 title=Upphafleg Uppsetning 143 143 docker_helper=Ef þú keyrir Forgejo inni í Docker þá viltu vinsamlegast lesa <a target="_blank" rel="noopener noreferrer" href="%s">leiðbeiningaritið</a> áður en þú breytir stillingum. 144 - require_db_desc=Forgejo krefst MySQL, PostgreSQL, MSSQL, SQLite3 eða TiDB (MySQL samskiptareglur). 144 + require_db_desc=Forgejo krefst MySQL, PostgreSQL, SQLite3 eða TiDB (MySQL samskiptareglur). 145 145 db_title=Gagnagrunnsstillingar 146 146 db_type=Tegund Gagnagrunns 147 147 host=Hýsill
+1 -2
options/locale/locale_it-IT.ini
··· 215 215 install=Installazione 216 216 title=Configurazione iniziale 217 217 docker_helper=Se stai usando Forgejo con Docker, leggi <a target="_blank" rel="noopener noreferrer" href="%s">la documentazione</a> prima di cambiare qualsiasi impostazione. 218 - require_db_desc=Forgejo requires MySQL, PostgreSQL, MSSQL, SQLite3 or TiDB (MySQL protocol). 218 + require_db_desc=Forgejo requires MySQL, PostgreSQL, SQLite3 or TiDB (MySQL protocol). 219 219 db_title=Impostazioni database 220 220 db_type=Tipo di database 221 221 host=Host ··· 3351 3351 self_check.database_collation_mismatch = Pretendi che la base di dati usi la collazione: %s 3352 3352 self_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 ...". 3353 3353 self_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. 3354 - self_check.database_fix_mssql = Gli utenti MSSQL possono provare a risolvere il problema tramite SQL con "ALTER ... COLLATE ..." manualmente, per il momento. 3355 3354 3356 3355 3357 3356 [action]
+1 -1
options/locale/locale_ja-JP.ini
··· 214 214 install=インストール 215 215 title=初期設定 216 216 docker_helper=ForgejoをDocker内で実行する場合は、設定を変更する前に<a target="_blank" rel="noopener noreferrer" href="%s">ドキュメント</a>を読んでください。 217 - require_db_desc=Forgejoには、MySQL、PostgreSQL、MSSQL、SQLite3、またはTiDB(MySQL プロトコル) が必要です。 217 + require_db_desc=Forgejoには、MySQL、PostgreSQL、SQLite3、またはTiDB(MySQL プロトコル) が必要です。 218 218 db_title=データベース設定 219 219 db_type=データベースのタイプ 220 220 host=ホスト
+1 -1
options/locale/locale_lv-LV.ini
··· 197 197 install=Instalācija 198 198 title=Sākotnējā konfigurācija 199 199 docker_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. 200 - require_db_desc=Forgejo nepieciešams MySQL, PostgreSQL, MSSQL, SQLite3 vai TiDB (izmantojot MySQL protokolu). 200 + require_db_desc=Forgejo nepieciešams MySQL, PostgreSQL, SQLite3 vai TiDB (izmantojot MySQL protokolu). 201 201 db_title=Datu bāzes iestatījumi 202 202 db_type=Datu bāzes veids 203 203 host=Resursdators
+1 -2
options/locale/locale_nl-NL.ini
··· 217 217 install=Installatie 218 218 title=Initiële configuratie 219 219 docker_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. 220 - require_db_desc=Forgejo vereist MySQL, PostgreSQL, MSSQL, SQLite3 of TiDB (MySQL protocol). 220 + require_db_desc=Forgejo vereist MySQL, PostgreSQL, SQLite3 of TiDB (MySQL protocol). 221 221 db_title=Database-instellingen 222 222 db_type=Database-type 223 223 host=Server ··· 3323 3323 monitor.processes_count = %d Processen 3324 3324 monitor.process.children = Kinderen 3325 3325 self_check.database_inconsistent_collation_columns = Database gebruikt collatie %s, maar deze kolommen gebruiken onjuiste collaties. Dit kan onverwachte problemen veroorzaken. 3326 - self_check.database_fix_mssql = Voor MSSQL gebruikers kan je het probleem alleen oplossen door "ALTER ... COLLATE ..." SQL's handmatig op te lossen. 3327 3326 monitor.stacktrace = Stacktrace 3328 3327 monitor.download_diagnosis_report = Diagnoserapport downloaden 3329 3328 self_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
··· 160 160 install=Instalacja 161 161 title=Wstępna konfiguracja 162 162 docker_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. 163 - require_db_desc=Forgejo wymaga MySQL, PostgreSQL, MSSQL, SQLite3 lub TiDB (protokół MySQL). 163 + require_db_desc=Forgejo wymaga MySQL, PostgreSQL, SQLite3 lub TiDB (protokół MySQL). 164 164 db_title=Ustawienia bazy danych 165 165 db_type=Typ bazy danych 166 166 host=Serwer
+1 -1
options/locale/locale_pt-BR.ini
··· 205 205 install=Instalação 206 206 title=Configuração inicial 207 207 docker_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. 208 - require_db_desc=Forgejo requer MySQL, PostgreSQL, MSSQL, SQLite3 ou TiDB (protocolo MySQL). 208 + require_db_desc=Forgejo requer MySQL, PostgreSQL, SQLite3 ou TiDB (protocolo MySQL). 209 209 db_title=Configurações de banco de dados 210 210 db_type=Tipo de banco de dados 211 211 host=Servidor
+1 -2
options/locale/locale_pt-PT.ini
··· 198 198 install=Instalação 199 199 title=Configuração inicial 200 200 docker_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. 201 - require_db_desc=Forgejo requer MySQL, PostgreSQL, MSSQL, SQLite3 ou TiDB (protocolo MySQL). 201 + require_db_desc=Forgejo requer MySQL, PostgreSQL, SQLite3 ou TiDB (protocolo MySQL). 202 202 db_title=Configurações da base de dados 203 203 db_type=Tipo de base de dados 204 204 host=Servidor ··· 3256 3256 self_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. 3257 3257 self_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. 3258 3258 self_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. 3259 - self_check.database_fix_mssql=Para utilizadores do MSSQL só pode resolver o problema aplicando comandos SQL "ALTER ... COLLATE ..." manualmente, por enquanto. 3260 3259 3261 3260 [action] 3262 3261 create_repo=criou o repositório <a href="%s">%s</a>
+1 -2
options/locale/locale_ru-RU.ini
··· 217 217 install=Установка 218 218 title=Начальная конфигурация 219 219 docker_helper=Если вы запускаете Forgejo под Docker, пожалуйста, ознакомьтесь с <a target="_blank" rel="noopener noreferrer" href="%s">документацией</a>, прежде чем изменять любые настройки. 220 - require_db_desc=Forgejo требует MySQL, PostgreSQL, MSSQL, SQLite3 или TiDB (по протоколу MySQL). 220 + require_db_desc=Forgejo требует MySQL, PostgreSQL, SQLite3 или TiDB (по протоколу MySQL). 221 221 db_title=Настройки базы данных 222 222 db_type=Тип базы данных 223 223 host=Хост ··· 3349 3349 self_check.no_problem_found = Пока проблем не обнаружено. 3350 3350 auths.tip.gitea = Зарегистрируйте новое приложение OAuth2. Доступна инструкция: https://forgejo.org/docs/latest/user/oauth2-provider 3351 3351 auths.tips.oauth2.general.tip = При регистрации нового приложения OAuth2 ссылка обратного перенаправления должна быть: 3352 - self_check.database_fix_mssql = В настоящий момент пользователи MSSQL могут исправить проблемы с сопоставлением только ручным прописыванием "ALTER ... COLLATE ..." в SQL. 3353 3352 self_check.database_fix_mysql = Пользователи MySQL и MariaDB могут исправить проблемы с сопоставлением командой "gitea doctor convert". Также можно вручную вписать "ALTER ... COLLATE ..." в SQL. 3354 3353 dashboard.cleanup_actions = Очистить устаревшие журналы и артефакты Действий 3355 3354 dashboard.sync_repo_branches = Синхронизировать ветки из Git в базу данных
+1 -1
options/locale/locale_sk-SK.ini
··· 196 196 install=Inštalácia 197 197 title=Východzia konfigurácia 198 198 docker_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í. 199 - require_db_desc=Forgejo vyžaduje MySQL, PostgreSQL, MSSQL, SQLite3 alebo TiDB (MySQL protokol). 199 + require_db_desc=Forgejo vyžaduje MySQL, PostgreSQL, SQLite3 alebo TiDB (MySQL protokol). 200 200 db_title=Nastavenie databázy 201 201 db_type=Typ databázy 202 202 host=Host
+1 -1
options/locale/locale_sl.ini
··· 133 133 134 134 [install] 135 135 reinstall_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. 136 - require_db_desc = Forgejo zahteva MySQL, PostgreSQL, MSSQL, SQLite3 ali TiDB (protokol MySQL). 136 + require_db_desc = Forgejo zahteva MySQL, PostgreSQL, SQLite3 ali TiDB (protokol MySQL). 137 137 password_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. 138 138 reinstall_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: 139 139 err_admin_name_is_reserved = Administrator Uporabniško ime je neveljavno, uporabniško ime je rezervirano
+1 -1
options/locale/locale_tr-TR.ini
··· 197 197 install=Kurulum 198 198 title=Başlangıç Yapılandırması 199 199 docker_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. 200 - require_db_desc=Forgejo MySQL, PostgreSQL, MSSQL, SQLite3 veya TiDB (MySQL protokolü) gerektirir. 200 + require_db_desc=Forgejo MySQL, PostgreSQL, SQLite3 veya TiDB (MySQL protokolü) gerektirir. 201 201 db_title=Veritabanı Ayarları 202 202 db_type=Veritabanı Türü 203 203 host=Sunucu
+1 -3
options/locale/locale_zh-CN.ini
··· 215 215 install=安装页面 216 216 title=初始配置 217 217 docker_helper=如果您正在使用 Docker 容器运行 Forgejo,请务必先仔细阅读 <a target="_blank" rel="noopener noreferrer" href="%s">官方文档</a> 后再对本页面进行填写。 218 - require_db_desc=Forgejo 需要使用 MySQL、PostgreSQL、MSSQL、SQLite3 或 TiDB (MySQL协议) 等数据库 218 + require_db_desc=Forgejo 需要使用 MySQL、PostgreSQL、SQLite3 或 TiDB (MySQL协议) 等数据库 219 219 db_title=数据库设置 220 220 db_type=数据库类型 221 221 host=数据库主机 ··· 3377 3377 self_check.database_collation_case_insensitive = 数据库正在使用 %s 排序规则,这是一种不敏感的排序规则。 尽管 Forgejo 可以使用它,但在极少数情况下可能无法按照预期工作。 3378 3378 self_check.database_inconsistent_collation_columns = 数据库正在使用 %s 排序规则,但与这些列使用的排序规则不匹配。 这可能会导致一些意想不到的问题。 3379 3379 self_check.database_fix_mysql = 对于 MySQL/MariaDB 用户,您可以使用 "gitea doctor convert" 命令来修复排序规则问题,也可以通过SQL命令 "ALTER ... COLLATE ..." 来手动修复问题。 3380 - self_check.database_fix_mssql = 对于 MSSQL 用户,目前您只能通过SQL命令 "ALTER ... COLLATE ..." 来手动修复问题。 3381 3380 3382 3381 self_check.no_problem_found=尚未发现问题。 3383 3382 self_check.database_collation_mismatch=期望数据库使用的校验方式:%s 3384 3383 self_check.database_collation_case_insensitive=数据库正在使用一个校验 %s, 这是一个不敏感的校验. 虽然Gitea可以与它合作,但可能有一些罕见的情况不如预期的那样起作用。 3385 3384 self_check.database_inconsistent_collation_columns=数据库正在使用%s的排序规则,但是这些列使用了不匹配的排序规则。这可能会造成一些意外问题。 3386 3385 self_check.database_fix_mysql=对于MySQL/MariaDB用户,您可以使用“gitea doctor convert”命令来解决校验问题。 或者您也可以通过 "ALTER ... COLLATE ..." 这样的SQL 来手动解决这个问题。 3387 - self_check.database_fix_mssql=对于MSSQL用户,您现在只能通过"ALTER ... COLLATE ..."SQLs手动解决这个问题。 3388 3386 auths.tips.gmail_settings = Gmail 设置: 3389 3387 auths.tip.gitlab_new = 在 https://gitlab.com/-/profile/applications 上注册新应用 3390 3388 config_settings = 设置
+1 -1
options/locale/locale_zh-TW.ini
··· 211 211 install=安裝頁面 212 212 title=初始組態 213 213 docker_helper=如果您在 Docker 中執行 Forgejo,請先閱讀<a target="_blank" rel="noopener noreferrer" href="%s">安裝指南</a>再來調整設定。 214 - require_db_desc=Forgejo 需要 MySQL、PostgreSQL、SQLite3、MSSQL、TiDB (MySQL 協定) 等其中一項。 214 + require_db_desc=Forgejo 需要 MySQL、PostgreSQL、SQLite3、TiDB (MySQL 協定) 等其中一項。 215 215 db_title=資料庫設定 216 216 db_type=資料庫類型 217 217 host=主機
+1 -1
routers/web/web.go
··· 654 654 m.Get("/system_status", admin.SystemStatus) 655 655 m.Post("", web.Bind(forms.AdminDashboardForm{}), admin.DashboardPost) 656 656 657 - if setting.Database.Type.IsMySQL() || setting.Database.Type.IsMSSQL() { 657 + if setting.Database.Type.IsMySQL() { 658 658 m.Get("/self_check", admin.SelfCheck) 659 659 } 660 660
+1 -1
templates/admin/navbar.tmpl
··· 4 4 <a class="{{if .PageIsAdminDashboard}}active {{end}}item" href="{{AppSubUrl}}/admin"> 5 5 {{ctx.Locale.Tr "admin.dashboard"}} 6 6 </a> 7 - {{if or .DatabaseType.IsMySQL .DatabaseType.IsMSSQL}} 7 + {{if .DatabaseType.IsMySQL}} 8 8 <a class="{{if .PageIsAdminSelfCheck}}active {{end}}item" href="{{AppSubUrl}}/admin/self_check"> 9 9 {{ctx.Locale.Tr "admin.self_check"}} 10 10 </a>
-2
templates/admin/self_check.tmpl
··· 8 8 {{if .DatabaseCheckHasProblems}} 9 9 {{if .DatabaseType.IsMySQL}} 10 10 <div class="tw-p-2">{{ctx.Locale.Tr "admin.self_check.database_fix_mysql"}}</div> 11 - {{else if .DatabaseType.IsMSSQL}} 12 - <div class="tw-p-2">{{ctx.Locale.Tr "admin.self_check.database_fix_mssql"}}</div> 13 11 {{end}} 14 12 {{if .DatabaseCheckCollationMismatch}} 15 13 <div class="ui red message">{{ctx.Locale.Tr "admin.self_check.database_collation_mismatch" .DatabaseCheckResult.ExpectedCollation}}</div>
+2 -13
tests/e2e/README.md
··· 7 7 make test-sqlite 8 8 make test-pgsql 9 9 make test-mysql 10 - make test-mssql 11 10 ``` 12 11 13 12 Make sure to perform a clean front-end build before running tests: ··· 53 52 TEST_PGSQL_HOST=localhost:5432 TEST_PGSQL_DBNAME=test TEST_PGSQL_USERNAME=postgres TEST_PGSQL_PASSWORD=postgres make test-e2e-pgsql 54 53 ``` 55 54 56 - ## Run mssql e2e tests 57 - Setup a mssql database inside docker 58 - ``` 59 - 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) 60 - ``` 61 - Start tests based on the database container 62 - ``` 63 - TEST_MSSQL_HOST=localhost:1433 TEST_MSSQL_DBNAME=gitea_test TEST_MSSQL_USERNAME=sa TEST_MSSQL_PASSWORD=MwantsaSecurePassword1 make test-e2e-mssql 64 - ``` 65 - 66 55 ## Running individual tests 67 56 68 57 Example command to run `example.test.e2e.js` test file: ··· 75 64 make test-e2e-sqlite#example 76 65 ``` 77 66 78 - For other databases(replace `mssql` to `mysql` or `pgsql`): 67 + For PostgreSQL databases(replace `mysql` to `pgsql`): 79 68 80 69 ``` 81 - TEST_MSSQL_HOST=localhost:1433 TEST_MSSQL_DBNAME=test TEST_MSSQL_USERNAME=sa TEST_MSSQL_PASSWORD=MwantsaSecurePassword1 make test-e2e-mssql#example 70 + TEST_MYSQL_HOST=localhost:1433 TEST_MYSQL_DBNAME=test TEST_MYSQL_USERNAME=sa TEST_MYSQL_PASSWORD=MwantsaSecurePassword1 make test-e2e-mysql#example 82 71 ``` 83 72 84 73 ## Visual testing
+2 -13
tests/integration/README.md
··· 6 6 make test-sqlite 7 7 make test-pgsql 8 8 make test-mysql 9 - make test-mssql 10 9 ``` 11 10 12 11 Make sure to perform a clean build before running tests: ··· 63 62 TEST_PGSQL_HOST=localhost:5432 TEST_PGSQL_DBNAME=test TEST_PGSQL_USERNAME=postgres TEST_PGSQL_PASSWORD=postgres make test-pgsql 64 63 ``` 65 64 66 - ## Run mssql integration tests 67 - Setup a mssql database inside docker 68 - ``` 69 - 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) 70 - ``` 71 - Start tests based on the database container 72 - ``` 73 - TEST_MSSQL_HOST=localhost:1433 TEST_MSSQL_DBNAME=gitea_test TEST_MSSQL_USERNAME=sa TEST_MSSQL_PASSWORD=MwantsaSecurePassword1 make test-mssql 74 - ``` 75 - 76 65 ## Running individual tests 77 66 78 67 Example command to run GPG test: ··· 83 72 make test-sqlite#GPG 84 73 ``` 85 74 86 - For other databases(replace `mssql` to `mysql`, or `pgsql`): 75 + For other databases (replace `mysql` to `pgsql`): 87 76 88 77 ``` 89 - TEST_MSSQL_HOST=localhost:1433 TEST_MSSQL_DBNAME=test TEST_MSSQL_USERNAME=sa TEST_MSSQL_PASSWORD=MwantsaSecurePassword1 make test-mssql#GPG 78 + TEST_MYSQL_HOST=localhost:1433 TEST_MYSQL_DBNAME=test TEST_MYSQL_USERNAME=sa TEST_MYSQL_PASSWORD=MwantsaSecurePassword1 make test-mysql#GPG 90 79 ``` 91 80 92 81 ## Setting timeouts for declaring long-tests and long-flushes
+2 -12
tests/integration/README_ZH.md
··· 59 59 TEST_PGSQL_HOST=localhost:5432 TEST_PGSQL_DBNAME=test TEST_PGSQL_USERNAME=postgres TEST_PGSQL_PASSWORD=postgres make test-pgsql 60 60 ``` 61 61 62 - ## Run mssql integration tests 63 - 同上,首先在 docker 容器里部署一个 mssql 数据库 64 - ``` 65 - 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) 66 - ``` 67 - 之后便可以基于这个数据库进行集成测试 68 - ``` 69 - TEST_MSSQL_HOST=localhost:1433 TEST_MSSQL_DBNAME=gitea_test TEST_MSSQL_USERNAME=sa TEST_MSSQL_PASSWORD=MwantsaSecurePassword1 make test-mssql 70 - ``` 71 - 72 62 ## 如何进行自定义的集成测试 73 63 74 64 下面的示例展示了怎样在集成测试中只进行 GPG 测试: ··· 79 69 make test-sqlite#GPG 80 70 ``` 81 71 82 - 其它数据库(把 MSSQL 替换为 MYSQL, PGSQL): 72 + 其它数据库 (用 PGSQL 取代 MYSQL): 83 73 84 74 ``` 85 - TEST_MSSQL_HOST=localhost:1433 TEST_MSSQL_DBNAME=test TEST_MSSQL_USERNAME=sa TEST_MSSQL_PASSWORD=MwantsaSecurePassword1 make test-mssql#GPG 75 + TEST_MYSQL_HOST=localhost:1433 TEST_MYSQL_DBNAME=test TEST_MYSQL_USERNAME=sa TEST_MYSQL_PASSWORD=MwantsaSecurePassword1 make test-mysql#GPG 86 76 ``` 87 77
+4 -14
tests/integration/db_collation_test.go
··· 39 39 htmlDoc.AssertElement(t, "a.item[href*='/admin/self_check']", exists) 40 40 } 41 41 42 - if setting.Database.Type.IsMySQL() || setting.Database.Type.IsMSSQL() { 42 + if setting.Database.Type.IsMySQL() { 43 43 assertSelfCheckExists(true) 44 44 } else { 45 45 assertSelfCheckExists(false) ··· 61 61 assert.EqualValues(t, 2, cnt) 62 62 _, _ = x.Exec("DROP TABLE IF EXISTS test_collation_tbl") 63 63 64 - // by default, SQLite3 and PostgreSQL are using case-sensitive collations, but MySQL and MSSQL are not 65 - // the following tests are only for MySQL and MSSQL 66 - if !setting.Database.Type.IsMySQL() && !setting.Database.Type.IsMSSQL() { 67 - t.Skip("only MySQL and MSSQL requires the case-sensitive collation check at the moment") 64 + // by default, SQLite3 and PostgreSQL are using case-sensitive collations, but MySQL is not. 65 + if !setting.Database.Type.IsMySQL() { 66 + t.Skip("only MySQL requires the case-sensitive collation check at the moment") 68 67 return 69 68 } 70 69 ··· 86 85 assert.True(t, r.CollationEquals("abc", "abc")) 87 86 assert.True(t, r.CollationEquals("abc", "utf8mb4_abc")) 88 87 assert.False(t, r.CollationEquals("utf8mb4_general_ci", "utf8mb4_unicode_ci")) 89 - } else if setting.Database.Type.IsMSSQL() { 90 - assert.True(t, r.IsCollationCaseSensitive("Latin1_General_CS_AS")) 91 - assert.False(t, r.IsCollationCaseSensitive("Latin1_General_CI_AS")) 92 - assert.True(t, r.CollationEquals("abc", "abc")) 93 - assert.False(t, r.CollationEquals("Latin1_General_CS_AS", "SQL_Latin1_General_CP1_CS_AS")) 94 88 } else { 95 89 assert.Fail(t, "unexpected database type") 96 90 } 97 91 }) 98 - 99 - if setting.Database.Type.IsMSSQL() { 100 - return // skip table converting tests because MSSQL doesn't have a simple solution at the moment 101 - } 102 92 103 93 t.Run("Convert tables to utf8mb4_bin", func(t *testing.T) { 104 94 defer tests.PrintCurrentTest(t)()
tests/integration/migration-test/gitea-v1.6.4.mssql.sql.gz

This is a binary file and will not be displayed.

tests/integration/migration-test/gitea-v1.7.0.mssql.sql.gz

This is a binary file and will not be displayed.

-26
tests/integration/migration-test/migration_test.go
··· 14 14 "path/filepath" 15 15 "regexp" 16 16 "sort" 17 - "strings" 18 17 "testing" 19 18 20 19 "code.gitea.io/gitea/models/db" ··· 257 256 258 257 _, err = db.Exec(data) 259 258 assert.NoError(t, err) 260 - db.Close() 261 - 262 - case setting.Database.Type.IsMSSQL(): 263 - host, port := setting.ParseMSSQLHostPort(setting.Database.Host) 264 - db, err := sql.Open("mssql", fmt.Sprintf("server=%s; port=%s; database=%s; user id=%s; password=%s;", 265 - host, port, "master", setting.Database.User, setting.Database.Passwd)) 266 - assert.NoError(t, err) 267 - defer db.Close() 268 - 269 - _, err = db.Exec("DROP DATABASE IF EXISTS [gitea]") 270 - assert.NoError(t, err) 271 - 272 - statements := strings.Split(data, "\nGO\n") 273 - for _, statement := range statements { 274 - if len(statement) > 5 && statement[:5] == "USE [" { 275 - dbname := statement[5 : len(statement)-1] 276 - db.Close() 277 - db, err = sql.Open("mssql", fmt.Sprintf("server=%s; port=%s; database=%s; user id=%s; password=%s;", 278 - host, port, dbname, setting.Database.User, setting.Database.Passwd)) 279 - assert.NoError(t, err) 280 - defer db.Close() 281 - } 282 - _, err = db.Exec(statement) 283 - assert.NoError(t, err, "Failure whilst running: %s\nError: %v", statement, err) 284 - } 285 259 db.Close() 286 260 } 287 261 return true
-107
tests/mssql.ini.tmpl
··· 1 - APP_NAME = Gitea: Git with a cup of tea 2 - RUN_MODE = prod 3 - 4 - [database] 5 - DB_TYPE = mssql 6 - HOST = {{TEST_MSSQL_HOST}} 7 - NAME = {{TEST_MSSQL_DBNAME}} 8 - USER = {{TEST_MSSQL_USERNAME}} 9 - PASSWD = {{TEST_MSSQL_PASSWORD}} 10 - SSL_MODE = disable 11 - 12 - [indexer] 13 - REPO_INDEXER_ENABLED = true 14 - REPO_INDEXER_PATH = tests/{{TEST_TYPE}}/gitea-{{TEST_TYPE}}-mssql/indexers/repos.bleve 15 - 16 - [queue.issue_indexer] 17 - TYPE = level 18 - DATADIR = tests/{{TEST_TYPE}}/gitea-{{TEST_TYPE}}-mssql/indexers/issues.queue 19 - 20 - [queue] 21 - TYPE = immediate 22 - 23 - [repository] 24 - ROOT = {{REPO_TEST_DIR}}tests/{{TEST_TYPE}}/gitea-{{TEST_TYPE}}-mssql/gitea-repositories 25 - 26 - [repository.local] 27 - LOCAL_COPY_PATH = tests/{{TEST_TYPE}}/gitea-{{TEST_TYPE}}-mssql/tmp/local-repo 28 - 29 - [repository.upload] 30 - TEMP_PATH = tests/{{TEST_TYPE}}/gitea-{{TEST_TYPE}}-mssql/tmp/uploads 31 - 32 - [repository.signing] 33 - SIGNING_KEY = none 34 - 35 - [server] 36 - SSH_DOMAIN = localhost 37 - HTTP_PORT = 3003 38 - ROOT_URL = http://localhost:3003/ 39 - DISABLE_SSH = false 40 - SSH_LISTEN_HOST = localhost 41 - SSH_PORT = 2201 42 - START_SSH_SERVER = true 43 - LFS_START_SERVER = true 44 - OFFLINE_MODE = false 45 - LFS_JWT_SECRET = Tv_MjmZuHqpIY6GFl12ebgkRAMt4RlWt0v4EHKSXO0w 46 - APP_DATA_PATH = tests/{{TEST_TYPE}}/gitea-{{TEST_TYPE}}-mssql/data 47 - BUILTIN_SSH_SERVER_USER = git 48 - SSH_TRUSTED_USER_CA_KEYS = ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCb4DC1dMFnJ6pXWo7GMxTchtzmJHYzfN6sZ9FAPFR4ijMLfGki+olvOMO5Fql1/yGnGfbELQa1S6y4shSvj/5K+zUFScmEXYf3Gcr87RqilLkyk16RS+cHNB1u87xTHbETaa3nyCJeGQRpd4IQ4NKob745mwDZ7jQBH8AZEng50Oh8y8fi8skBBBzaYp1ilgvzG740L7uex6fHV62myq0SXeCa+oJUjq326FU8y+Vsa32H8A3e7tOgXZPdt2TVNltx2S9H2WO8RMi7LfaSwARNfy1zu+bfR50r6ef8Yx5YKCMz4wWb1SHU1GS800mjOjlInLQORYRNMlSwR1+vLlVDciOqFapDSbj+YOVOawR0R1aqlSKpZkt33DuOBPx9qe6CVnIi7Z+Px/KqM+OLCzlLY/RS+LbxQpDWcfTVRiP+S5qRTcE3M3UioN/e0BE/1+MpX90IGpvVkA63ILYbKEa4bM3ASL7ChTCr6xN5XT+GpVJveFKK1cfNx9ExHI4rzYE= 49 - 50 - [attachment] 51 - PATH = tests/{{TEST_TYPE}}/gitea-{{TEST_TYPE}}-mssql/data/attachments 52 - 53 - [mailer] 54 - ENABLED = true 55 - PROTOCOL = dummy 56 - FROM = mssql-{{TEST_TYPE}}-test@gitea.io 57 - 58 - [service] 59 - REGISTER_EMAIL_CONFIRM = false 60 - REGISTER_MANUAL_CONFIRM = false 61 - DISABLE_REGISTRATION = false 62 - ENABLE_CAPTCHA = false 63 - REQUIRE_SIGNIN_VIEW = false 64 - DEFAULT_KEEP_EMAIL_PRIVATE = false 65 - DEFAULT_ALLOW_CREATE_ORGANIZATION = true 66 - NO_REPLY_ADDRESS = noreply.example.org 67 - ENABLE_NOTIFY_MAIL = true 68 - 69 - [picture] 70 - DISABLE_GRAVATAR = false 71 - ENABLE_FEDERATED_AVATAR = false 72 - AVATAR_UPLOAD_PATH = tests/{{TEST_TYPE}}/gitea-{{TEST_TYPE}}-mssql/data/avatars 73 - REPOSITORY_AVATAR_UPLOAD_PATH = tests/{{TEST_TYPE}}/gitea-{{TEST_TYPE}}-mssql/data/repo-avatars 74 - 75 - [session] 76 - PROVIDER = file 77 - PROVIDER_CONFIG = tests/{{TEST_TYPE}}/gitea-{{TEST_TYPE}}-mssql/data/sessions 78 - 79 - [log] 80 - MODE = {{TEST_LOGGER}} 81 - ROOT_PATH = {{REPO_TEST_DIR}}mssql-log 82 - ENABLE_SSH_LOG = true 83 - logger.xorm.MODE = file 84 - 85 - [log.test] 86 - LEVEL = Info 87 - COLORIZE = true 88 - 89 - [log.file] 90 - LEVEL = Debug 91 - 92 - [security] 93 - PASSWORD_HASH_ALGO = argon2 94 - DISABLE_GIT_HOOKS = false 95 - INSTALL_LOCK = true 96 - SECRET_KEY = 9pCviYTWSb 97 - INTERNAL_TOKEN = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE0OTU1NTE2MTh9.hhSVGOANkaKk3vfCd2jDOIww4pUk0xtg9JRde5UogyQ 98 - DISABLE_QUERY_AUTH_TOKEN = true 99 - 100 - [lfs] 101 - PATH = tests/{{TEST_TYPE}}/gitea-{{TEST_TYPE}}-mssql/data/lfs 102 - 103 - [packages] 104 - ENABLED = true 105 - 106 - [actions] 107 - ENABLED = true
-12
tests/test_utils.go
··· 162 162 log.Fatal("db.Exec: CREATE SCHEMA: %v", err) 163 163 } 164 164 } 165 - 166 - case setting.Database.Type.IsMSSQL(): 167 - host, port := setting.ParseMSSQLHostPort(setting.Database.Host) 168 - db, err := sql.Open("mssql", fmt.Sprintf("server=%s; port=%s; database=%s; user id=%s; password=%s;", 169 - host, port, "master", setting.Database.User, setting.Database.Passwd)) 170 - if err != nil { 171 - log.Fatal("sql.Open: %v", err) 172 - } 173 - if _, err := db.Exec(fmt.Sprintf("If(db_id(N'%s') IS NULL) BEGIN CREATE DATABASE %s; END;", setting.Database.Name, setting.Database.Name)); err != nil { 174 - log.Fatal("db.Exec: %v", err) 175 - } 176 - defer db.Close() 177 165 } 178 166 179 167 routers.InitWebInstalled(graceful.GetManager().HammerContext())
-1
web_src/js/features/install.js
··· 19 19 const defaultDbHosts = { 20 20 mysql: '127.0.0.1:3306', 21 21 postgres: '127.0.0.1:5432', 22 - mssql: '127.0.0.1:1433', 23 22 }; 24 23 25 24 const dbHost = document.getElementById('db_host');