Skip to content

Commit

Permalink
fix alter database collation (#324)
Browse files Browse the repository at this point in the history
fixes #323
  • Loading branch information
chdsbd authored Nov 7, 2023
1 parent a4b5d41 commit fdbb684
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## v0.24.2 - 2023-11-07

### Fixed

- support parsing `alter database refresh collation` statements (#324)

## v0.24.1 - 2023-10-24

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "squawk"
version = "0.24.1"
version = "0.24.2"
authors = ["Steve Dignam <steve@dignam.xyz>"]
edition = "2018"
license = "GPL-3.0"
Expand Down
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
{
squawk = final.rustPlatform.buildRustPackage {
pname = "squawk";
version = "0.24.1";
version = "0.24.2";

cargoLock = {
lockFile = ./Cargo.lock;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "squawk-cli",
"version": "0.24.1",
"version": "0.24.2",
"description": "linter for PostgreSQL, focused on migrations",
"repository": "git@github.com:sbdchd/squawk.git",
"author": "Steve Dignam <steve@dignam.xyz>",
Expand Down
1 change: 1 addition & 0 deletions parser/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,7 @@ pub enum Stmt {
ViewStmt(Value),
LoadStmt(Value),
CreatedbStmt(Value),
AlterDatabaseRefreshCollStmt(Value),
AlterDatabaseStmt(Value),
AlterDatabaseSetStmt(Value),
DropdbStmt(Value),
Expand Down
9 changes: 9 additions & 0 deletions parser/src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -965,6 +965,15 @@ ALTER DATABASE name RESET ALL;
assert_debug_snapshot!(res);
}

#[test]
fn test_alter_database_collation() {
let sql = r#"
ALTER DATABASE pipelines REFRESH COLLATION VERSION;
"#;
let res = parse_sql_query(sql);
assert_debug_snapshot!(res);
}

#[test]
fn test_drop_database_stmt() {
let sql = r#"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
source: parser/src/parse.rs
expression: res
---
Ok(
[
RawStmt {
stmt: AlterDatabaseRefreshCollStmt(
Object({
"dbname": String(
"pipelines",
),
}),
),
stmt_location: 0,
stmt_len: Some(
51,
),
},
],
)

0 comments on commit fdbb684

Please sign in to comment.