Skip to content

Commit 5eef981

Browse files
committed
progress
1 parent 0ae6ab8 commit 5eef981

File tree

4 files changed

+9
-11
lines changed

4 files changed

+9
-11
lines changed

crates/pgt_configuration/src/analyser/linter/rules.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ impl Safety {
724724
}
725725
pub(crate) fn severity(rule_name: &str) -> Severity {
726726
match rule_name {
727-
"addSerialColumn" => Severity::Error,
727+
"addSerialColumn" => Severity::Warning,
728728
"addingFieldWithDefault" => Severity::Warning,
729729
"addingForeignKeyConstraint" => Severity::Warning,
730730
"addingNotNullField" => Severity::Warning,
@@ -741,7 +741,7 @@ impl Safety {
741741
"constraintMissingNotValid" => Severity::Warning,
742742
"creatingEnum" => Severity::Warning,
743743
"disallowUniqueConstraint" => Severity::Error,
744-
"lockTimeoutWarning" => Severity::Error,
744+
"lockTimeoutWarning" => Severity::Warning,
745745
"multipleAlterTable" => Severity::Warning,
746746
"preferBigInt" => Severity::Warning,
747747
"preferBigintOverInt" => Severity::Warning,
@@ -755,7 +755,7 @@ impl Safety {
755755
"renamingTable" => Severity::Warning,
756756
"requireConcurrentIndexCreation" => Severity::Warning,
757757
"requireConcurrentIndexDeletion" => Severity::Warning,
758-
"runningStatementWhileHoldingAccessExclusive" => Severity::Error,
758+
"runningStatementWhileHoldingAccessExclusive" => Severity::Warning,
759759
"transactionNesting" => Severity::Warning,
760760
_ => unreachable!(),
761761
}

crates/pgt_lsp/tests/server.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1690,9 +1690,7 @@ ALTER TABLE ONLY "public"."campaign_contact_list"
16901690
.filter(|d| {
16911691
d.code.as_ref().is_none_or(|c| match c {
16921692
lsp::NumberOrString::Number(_) => true,
1693-
lsp::NumberOrString::String(s) => {
1694-
s != "lint/safety/addingForeignKeyConstraint"
1695-
}
1693+
lsp::NumberOrString::String(s) => !s.starts_with("lint/safety"),
16961694
})
16971695
})
16981696
.count()

docs/reference/rules/add-serial-column.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ ALTER TABLE prices ADD COLUMN id serial;
3030
```sh
3131
code-block.sql:1:1 lint/safety/addSerialColumn ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
3232

33-
× Adding a column with type serial requires a table rewrite.
33+
! Adding a column with type serial requires a table rewrite.
3434

3535
> 1 │ ALTER TABLE prices ADD COLUMN id serial;
3636
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -50,7 +50,7 @@ ALTER TABLE prices ADD COLUMN id bigserial;
5050
```sh
5151
code-block.sql:1:1 lint/safety/addSerialColumn ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
5252

53-
× Adding a column with type bigserial requires a table rewrite.
53+
! Adding a column with type bigserial requires a table rewrite.
5454

5555
> 1 │ ALTER TABLE prices ADD COLUMN id bigserial;
5656
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -70,7 +70,7 @@ ALTER TABLE prices ADD COLUMN total int GENERATED ALWAYS AS (price * quantity) S
7070
```sh
7171
code-block.sql:1:1 lint/safety/addSerialColumn ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
7272

73-
× Adding a column with GENERATED ALWAYS AS ... STORED requires a table rewrite.
73+
! Adding a column with GENERATED ALWAYS AS ... STORED requires a table rewrite.
7474

7575
> 1 │ ALTER TABLE prices ADD COLUMN total int GENERATED ALWAYS AS (price * quantity) STORED;
7676
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

docs/reference/rules/lock-timeout-warning.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ ALTER TABLE users ADD COLUMN email TEXT;
3333
```sh
3434
code-block.sql:1:1 lint/safety/lockTimeoutWarning ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
3535

36-
× Statement takes ACCESS EXCLUSIVE lock on public.users without lock timeout set.
36+
! Statement takes ACCESS EXCLUSIVE lock on public.users without lock timeout set.
3737

3838
> 1 │ ALTER TABLE users ADD COLUMN email TEXT;
3939
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -53,7 +53,7 @@ CREATE INDEX users_email_idx ON users(email);
5353
```sh
5454
code-block.sql:1:1 lint/safety/lockTimeoutWarning ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
5555

56-
× Statement takes SHARE lock on public.users while creating index users_email_idx without lock timeout set.
56+
! Statement takes SHARE lock on public.users while creating index users_email_idx without lock timeout set.
5757

5858
> 1 │ CREATE INDEX users_email_idx ON users(email);
5959
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)