Skip to content
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

[UPDATED] Moved sql scripts to scripts/ directory #870

Merged
merged 1 commit into from
Jul 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ You can update the SQL table manually or run the provided scripts that create th
and alter the `Clients` table adding the new column. For instance, with MySQL, you would run something similar to:

```
mysql -u root nss_db < mysql.db.sql
mysql -u root nss_db < scripts/mysql.db.sql
```
The above assumes you are in the NATS Streaming Server directory, and the streaming database is called `nss_db`.

Expand Down Expand Up @@ -2007,7 +2007,7 @@ contains the information required to connect to a specific database on the given
Note that the NATS Streaming Server does not need root privileges to connect to the database since it does not create
the database, tables or indexes. This has to be done by the Database Administrator.

We provide 2 files (`mysql.db.sql` and `postgres.db.sql`) that can be used to create the tables and indexes to the
We provide 2 files (`scripts/mysql.db.sql` and `scripts/postgres.db.sql`) that can be used to create the tables and indexes to the
database of your choice. However, administrators are free to configure and optimize the database as long as the name of tables
and columns are preserved, since the NATS Streaming Server is going to issue SQL statements based on those.

Expand All @@ -2022,7 +2022,7 @@ and selecting the `nss_db` database. We then execute all the SQL statements crea
is provided in this repo:

```
mysql -u nss -p -D nss_db -e "$(cat ./mysql.db.sql)"
mysql -u nss -p -D nss_db -e "$(cat ./scripts/mysql.db.sql)"
```

#### SQL Store Example - Postgres
Expand All @@ -2035,13 +2035,13 @@ ID=$(docker run -d -e POSTGRES_PASSWORD=password -p 5432:5432 postgres)
[Optional] Drop any previous tables to clear data from previous sessions:

```
cat drop_postgres.db.sql | docker exec -i $ID psql -h 127.0.1.1 -U postgres
cat scripts/drop_postgres.db.sql | docker exec -i $ID psql -h 127.0.1.1 -U postgres
```

Run the appropriate database migrations for Postgres:

```
cat postgres.db.sql | docker exec -i $ID psql -h 127.0.1.1 -U postgres
cat scripts/postgres.db.sql | docker exec -i $ID psql -h 127.0.1.1 -U postgres
```

Run the nats streaming server with postgres at the sql_source:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion test/sqlstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func CreateSQLDatabase(driver, sourceAdmin, source, dbName string) error {
}

func loadCreateDatabaseStmts(driver string) ([]string, error) {
fileName := "../" + driver + ".db.sql"
fileName := "../scripts/" + driver + ".db.sql"
file, err := os.Open(fileName)
if err != nil {
return nil, fmt.Errorf("error opening file: %v", err)
Expand Down