Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f2af68f

Browse files
committed
Clean up script file locations
1 parent 2c8b1fa commit f2af68f

7 files changed

Lines changed: 15 additions & 11 deletions

File tree

.github/workflows/dataset_measure.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
target
3939
key: ${{ runner.os }}-qltest-cargo-${{ hashFiles('**/Cargo.lock') }}
4040
- name: Build Extractor
41-
run: env "PATH=$PATH:${{ github.workspace }}/codeql" ./create-extractor-pack.sh
41+
run: env "PATH=$PATH:${{ github.workspace }}/codeql" scripts/create-extractor-pack.sh
4242

4343
- name: Checkout ${{ matrix.repo }}
4444
uses: actions/checkout@v2

.github/workflows/qltest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
target
3030
key: ${{ runner.os }}-qltest-cargo-${{ hashFiles('**/Cargo.lock') }}
3131
- name: Build Extractor
32-
run: env "PATH=$PATH:${{ github.workspace }}/codeql" ./create-extractor-pack.sh
32+
run: env "PATH=$PATH:${{ github.workspace }}/codeql" scripts/create-extractor-pack.sh
3333
- name: Run QL tests
3434
run: codeql/codeql test run --check-databases --check-unused-labels --check-repeated-labels --check-redefined-labels --check-use-before-definition --search-path "${{ github.workspace }}" --consistency-queries ql/consistency-queries ql/test
3535
- name: Check QL formatting

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ codeql query format -i ql/src/codeql_ruby/ast/internal/TreeSitter.qll
2626
First, get an extractor pack. There are two options:
2727

2828
1. Either download the latest `codeql-ruby-pack` from Actions and unzip it twice, or
29-
2. Run `./create-extractor-pack.sh` (Linux/Mac) or `.\create-extractor-pack.ps1` (Windows PowerShell) and the pack will be created in the `extractor-pack` directory.
29+
2. Run `scripts/create-extractor-pack.sh` (Linux/Mac) or `scripts\create-extractor-pack.ps1` (Windows PowerShell) and the pack will be created in the `extractor-pack` directory.
3030

3131
Then run
3232

@@ -41,3 +41,7 @@ Run
4141
```bash
4242
codeql test run <test-path> --search-path <repository-root-path>
4343
```
44+
45+
## Writing database upgrade scripts
46+
47+
See [this guide](doc/prepare-db-upgrade.md).
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ The schema (`ql/src/ruby.dbscheme`) is automatically generated from tree-sitter'
55
## Process Overview
66

77
1. Commit the change to `ruby.dbscheme` (along with any library updates required to work with the change).
8-
2. Run `prepare-db-upgrade.sh`.
8+
2. Run `scripts/prepare-db-upgrade.sh`.
99
3. Fill in the details in `upgrade.properties`, and add any required upgrade queries.
1010

1111
It may be helpful to look at some of the existing upgrade scripts, to see how they work.
@@ -18,7 +18,7 @@ Schema changes need to be accompanied by scripts that allow us to upgrade databa
1818

1919
#### The easy (mostly automatic) way
2020

21-
The easy way to generate an upgrade script is to run the `prepare-db-upgrade.sh` script. This will generate a skeleton upgrade directory, leaving you to fill out the details in the `upgrade.properties` file.
21+
The easy way to generate an upgrade script is to run the `scripts/prepare-db-upgrade.sh` script. This will generate a skeleton upgrade directory, leaving you to fill out the details in the `upgrade.properties` file.
2222

2323
#### upgrade.properties
2424

@@ -42,16 +42,16 @@ The `compatibility` field takes one of four values:
4242

4343
* **breaking**: the step is unsafe and will prevent certain queries from working.
4444

45-
The `some_relation.rel` line(s) are the actions required to do the database upgrade. Do a diff on the the new vs old `.dbscheme` file to get an idea of what they have to achieve. Sometimes you won't need any upgrade commands – this happens when the dbscheme has changed in "cosmetic" ways, for example by adding/removing comments or changing union type relationships, but still retains the same on-disk format for all tables; the purpose of the upgrade script is then to document the fact that it's safe to replace the old dbscheme with the new one).
45+
The `some_relation.rel` line(s) are the actions required to do the database upgrade. Do a diff on the the new vs old `.dbscheme` file to get an idea of what they have to achieve. Sometimes you won't need any upgrade commands – this happens when the dbscheme has changed in "cosmetic" ways, for example by adding/removing comments or changing union type relationships, but still retains the same on-disk format for all tables; the purpose of the upgrade script is then to document the fact that it's safe to replace the old dbscheme with the new one.
4646

4747
Some typical upgrade commands look like this:
4848

4949
```
5050
// Delete a relation that has been replaced in the new scheme
5151
obsolete.rel: delete
52-
53-
// Create a new version of a table by applying a simple RA expression to an
54-
// existing table. The example duplicates the 'id' column of input.rel as
52+
53+
// Create a new version of a table by applying a simple RA expression to an
54+
// existing table. The example duplicates the 'id' column of input.rel as
5555
// the last column of etended.rel, perhaps to record our best guess at
5656
// newly-populated "source declaration" information.
5757
extended.rel: reorder input.rel (int id, string name, int parent) id name parent id
@@ -79,13 +79,13 @@ Upgrade scripts can be a little bit fiddly, so it's essential that you test them
7979

8080
#### Doing the upgrade manually
8181

82-
To create the upgrade directory manually, without using `prepare-db-upgrade.sh`:
82+
To create the upgrade directory manually, without using `scripts/prepare-db-upgrade.sh`:
8383

8484
1. Get a hash of the old `.dbscheme` file, from just before your changes. You can do this by checking out the code prior to your changes and running `git hash-object ql/src/ruby.dbscheme`
8585

8686
2. Go back to your branch and create an upgrade directory with that hash as its name, for example: `mkdir ql/src/upgrades/454f1e15151422355049dc4f1f0486a03baeffef`
8787

8888
3. Copy the old `.dbscheme` file to that directory, using the name old.dbscheme.
8989
`cp ql/src/ruby.dbscheme ql/src/upgrades/454f1e15151422355049dc4f1f0486a03baeffef/old.dbscheme`
90-
90+
9191
4. Put a copy of your new `.dbscheme` file in that directory and create an `upgrade.properties` file (as described above).

0 commit comments

Comments
 (0)