-
Notifications
You must be signed in to change notification settings - Fork 11.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Indexer/TiDB][chore] Fix schema indentation and capitalization #17687
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,26 +59,56 @@ Run this command under `sui/crates/sui-indexer`, which will wipe DB; In case of | |
```sh | ||
diesel database reset --database-url="<DATABASE_URL>" | ||
``` | ||
### Local Development(TiDB) | ||
|
||
## Steps to run locally (TiDB) | ||
|
||
### Prerequisites | ||
|
||
1. Install TiDB | ||
|
||
``` sh | ||
curl --proto '=https' --tlsv1.2 -sSf https://tiup-mirrors.pingcap.com/install.sh | sh | ||
``` | ||
|
||
2. Install a compatible version of MySQL (At the time of writing, this is MySQL 8.0 -- note that 8.3 is incompatible). | ||
|
||
``` sh | ||
brew install [email protected] | ||
``` | ||
|
||
3. Install a version of `diesel_cli` that supports MySQL (and probably also Postgres). This version of the CLI needs to be built against the version of MySQL that was installed in the previous step (compatible with the local installation of TiDB, 8.0.37 at time of writing). | ||
|
||
``` sh | ||
MYSQLCLIENT_LIB_DIR=/opt/homebrew/Cellar/[email protected]/8.0.37/lib/ cargo install diesel_cli --no-default-features --features postgres --features mysql --force | ||
``` | ||
|
||
### Run the indexer | ||
|
||
1.Run TiDB | ||
|
||
```sh | ||
curl --proto '=https' --tlsv1.2 -sSf https://tiup-mirrors.pingcap.com/install.sh | sh | ||
tiup playground | ||
``` | ||
|
||
2.Verify tidb is running by connecting to it using the mysql client, create database `test` | ||
|
||
```sh | ||
mysql --comments --host 127.0.0.1 --port 4000 -u root | ||
create database test; | ||
``` | ||
``` | ||
|
||
3.DB setup, under `sui/crates/sui-indexer` run: | ||
|
||
```sh | ||
# an example DATABASE_URL is "mysql://root:[email protected]:4000/test" | ||
diesel setup --database-url="<DATABASE_URL> --migration-dir='migrations/mysql'" | ||
diesel database reset --database-url="<DATABASE_URL> --migration-dir='migrations/mysql'" | ||
``` | ||
|
||
Note that you'll need an existing database for the above to work. Replace `test` with the name of the database created. | ||
4. run indexer as a writer, which pulls data from fullnode and writes data to DB | ||
|
||
```sh | ||
# Change the RPC_CLIENT_URL to http://0.0.0.0:9000 to run indexer against local validator & fullnode | ||
cargo run --bin sui-indexer --features mysql-feature --no-default-features -- --db-url "<DATABASE_URL>" --rpc-client-url "https://fullnode.devnet.sui.io:443" --fullnode-sync-worker --reset-db | ||
``` | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 12 additions & 12 deletions
24
crates/sui-indexer/migrations/mysql/2024-03-26-004025_transactions/up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍