feat: kubesphere 4.0 (#6115)

* feat: kubesphere 4.0

Signed-off-by: ci-bot <ci-bot@kubesphere.io>

* feat: kubesphere 4.0

Signed-off-by: ci-bot <ci-bot@kubesphere.io>

---------

Signed-off-by: ci-bot <ci-bot@kubesphere.io>
Co-authored-by: ks-ci-bot <ks-ci-bot@example.com>
Co-authored-by: joyceliu <joyceliu@yunify.com>
This commit is contained in:
KubeSphere CI Bot
2024-09-06 11:05:52 +08:00
committed by GitHub
parent b5015ec7b9
commit 447a51f08b
8557 changed files with 546695 additions and 1146174 deletions

View File

@@ -2,20 +2,19 @@
> SQL Schema migration tool for [Go](https://golang.org/). Based on [gorp](https://github.com/go-gorp/gorp) and [goose](https://bitbucket.org/liamstask/goose).
[![Build Status](https://travis-ci.org/rubenv/sql-migrate.svg?branch=master)](https://travis-ci.org/rubenv/sql-migrate) [![GoDoc](https://godoc.org/github.com/rubenv/sql-migrate?status.svg)](https://godoc.org/github.com/rubenv/sql-migrate)
Using [modl](https://github.com/jmoiron/modl)? Check out [modl-migrate](https://github.com/rubenv/modl-migrate).
[![Test](https://github.com/rubenv/sql-migrate/actions/workflows/test.yml/badge.svg)](https://github.com/rubenv/sql-migrate/actions/workflows/test.yml) [![Go Reference](https://pkg.go.dev/badge/github.com/rubenv/sql-migrate.svg)](https://pkg.go.dev/github.com/rubenv/sql-migrate)
## Features
* Usable as a CLI tool or as a library
* Supports SQLite, PostgreSQL, MySQL, MSSQL and Oracle databases (through [gorp](https://github.com/go-gorp/gorp))
* Can embed migrations into your application
* Migrations are defined with SQL for full flexibility
* Atomic migrations
* Up/down migrations to allow rollback
* Supports multiple database types in one project
* Works great with other libraries such as [sqlx](https://jmoiron.github.io/sqlx/)
- Usable as a CLI tool or as a library
- Supports SQLite, PostgreSQL, MySQL, MSSQL and Oracle databases (through [gorp](https://github.com/go-gorp/gorp))
- Can embed migrations into your application
- Migrations are defined with SQL for full flexibility
- Atomic migrations
- Up/down migrations to allow rollback
- Supports multiple database types in one project
- Works great with other libraries such as [sqlx](https://jmoiron.github.io/sqlx/)
- Supported on go1.13+
## Installation
@@ -24,7 +23,9 @@ To install the library and command line program, use the following:
```bash
go get -v github.com/rubenv/sql-migrate/...
```
For Go version from 1.18, use:
```bash
go install github.com/rubenv/sql-migrate/...@latest
```
@@ -49,15 +50,15 @@ Each command requires a configuration file (which defaults to `dbconfig.yml`, bu
```yml
development:
dialect: sqlite3
datasource: test.db
dir: migrations/sqlite3
dialect: sqlite3
datasource: test.db
dir: migrations/sqlite3
production:
dialect: postgres
datasource: dbname=myapp sslmode=disable
dir: migrations/postgres
table: migrations
dialect: postgres
datasource: dbname=myapp sslmode=disable
dir: migrations/postgres
table: migrations
```
(See more examples for different set ups [here](test-integration/dbconfig.yml))
@@ -67,10 +68,10 @@ This may be useful if one doesn't want to store credentials in file:
```yml
production:
dialect: postgres
datasource: host=prodhost dbname=proddb user=${DB_USER} password=${DB_PASSWORD} sslmode=required
dir: migrations
table: migrations
dialect: postgres
datasource: host=prodhost dbname=proddb user=${DB_USER} password=${DB_PASSWORD} sslmode=require
dir: migrations
table: migrations
```
The `table` setting is optional and will default to `gorp_migrations`.
@@ -90,12 +91,13 @@ Options:
-config=dbconfig.yml Configuration file to use.
-env="development" Environment.
-limit=0 Limit the number of migrations (0 = unlimited).
-version Run migrate up to a specific version, eg: the version number of migration 1_initial.sql is 1.
-dryrun Don't apply migrations, just print them.
```
The `new` command creates a new empty migration template using the following pattern `<current time>-<name>.sql`.
The `up` command applies all available migrations. By contrast, `down` will only apply one migration by default. This behavior can be changed for both by using the `-limit` parameter.
The `up` command applies all available migrations. By contrast, `down` will only apply one migration by default. This behavior can be changed for both by using the `-limit` parameter, and the `-version` parameter. Note `-version` has higher priority than `-limit` if you try to use them both.
The `redo` command will unapply the last migration and reapply it. This is useful during development, when you're writing migrations.
@@ -112,6 +114,7 @@ $ sql-migrate status
```
#### Running Test Integrations
You can see how to run setups for different setups by executing the `.sh` files in [test-integration](test-integration/)
```bash
@@ -126,15 +129,16 @@ If you are using MySQL, you must append `?parseTime=true` to the `datasource` co
```yml
production:
dialect: mysql
datasource: root@/dbname?parseTime=true
dir: migrations/mysql
table: migrations
dialect: mysql
datasource: root@/dbname?parseTime=true
dir: migrations/mysql
table: migrations
```
See [here](https://github.com/go-sql-driver/mysql#parsetime) for more information.
### Oracle (oci8)
Oracle Driver is [oci8](https://github.com/mattn/go-oci8), it is not pure Go code and relies on Oracle Office Client ([Instant Client](https://www.oracle.com/database/technologies/instant-client/downloads.html)), more detailed information is in the [oci8 repo](https://github.com/mattn/go-oci8).
#### Install with Oracle support
@@ -147,13 +151,14 @@ go get -tags oracle -v github.com/rubenv/sql-migrate/...
```yml
development:
dialect: oci8
datasource: user/password@localhost:1521/sid
dir: migrations/oracle
table: migrations
dialect: oci8
datasource: user/password@localhost:1521/sid
dir: migrations/oracle
table: migrations
```
### Oracle (godror)
Oracle Driver is [godror](https://github.com/godror/godror), it is not pure Go code and relies on Oracle Office Client ([Instant Client](https://www.oracle.com/database/technologies/instant-client/downloads.html)), more detailed information is in the [godror repository](https://github.com/godror/godror).
#### Install with Oracle support
@@ -161,29 +166,31 @@ Oracle Driver is [godror](https://github.com/godror/godror), it is not pure Go c
To install the library and command line program, use the following:
1. Install sql-migrate
```bash
go get -tags godror -v github.com/rubenv/sql-migrate/...
```
2. Download Oracle Office Client(e.g. macos, click [Instant Client](https://www.oracle.com/database/technologies/instant-client/downloads.html) if you are other system)
```bash
wget https://download.oracle.com/otn_software/mac/instantclient/193000/instantclient-basic-macos.x64-19.3.0.0.0dbru.zip
```
3. Configure environment variables `LD_LIBRARY_PATH`
```
export LD_LIBRARY_PATH=your_oracle_office_path/instantclient_19_3
```
```yml
development:
dialect: godror
datasource: user/password@localhost:1521/sid
dir: migrations/oracle
table: migrations
dialect: godror
datasource: user/password@localhost:1521/sid
dir: migrations/oracle
table: migrations
```
### As a library
Import sql-migrate into your application:
@@ -254,6 +261,7 @@ Note that `n` can be greater than `0` even if there is an error: any migration t
Check [the GoDoc reference](https://godoc.org/github.com/rubenv/sql-migrate) for the full documentation.
## Writing migrations
Migrations are defined in SQL files, which contain a set of SQL statements. Special comments are used to distinguish up and down migrations.
```sql
@@ -399,6 +407,10 @@ if err != nil {
}
```
## Questions or Feedback?
You can use Github Issues for feedback or questions.
## License
This library is distributed under the [MIT](LICENSE) license.