Skip to content

Commit 2528b8f

Browse files
Merge pull request #1 from sqlc-plugins/dependabot/cargo/sqlparser-0.59.0
2 parents faf6900 + 866dbe6 commit 2528b8f

File tree

3 files changed

+170
-9
lines changed

3 files changed

+170
-9
lines changed

Cargo.lock

Lines changed: 162 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ description = "A crate for building sqlc plugins"
77

88
[dependencies]
99
prost = "0.14.1"
10-
sqlparser = "0.50"
10+
sqlparser = "0.59"
1111

1212
[build-dependencies]
1313
prost-build = "0.14.1"

src/schema.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,15 +245,18 @@ impl SchemaDef {
245245
&mut self,
246246
name: Option<ObjectName>,
247247
table_name: ObjectName,
248-
columns: Vec<sqlparser::ast::OrderByExpr>,
248+
indices: Vec<sqlparser::ast::IndexColumn>,
249249
unique: bool,
250250
) -> Result<(), String> {
251251
let table_name_str = object_name_to_string(&table_name);
252252

253253
if let Some(index_name) = name {
254254
let index = IndexDef {
255255
name: object_name_to_string(&index_name),
256-
columns: columns.iter().map(|col| format!("{}", col.expr)).collect(),
256+
columns: indices
257+
.iter()
258+
.map(|index| format!("{}", index.column))
259+
.collect(),
257260
unique,
258261
};
259262

@@ -274,7 +277,8 @@ impl SchemaDef {
274277
let table_name = object_name_to_string(&name);
275278

276279
for operation in operations {
277-
if let sqlparser::ast::AlterTableOperation::AddConstraint(constraint) = operation {
280+
if let sqlparser::ast::AlterTableOperation::AddConstraint { constraint, .. } = operation
281+
{
278282
if let Some(table_schema) = self.tables.get_mut(&table_name) {
279283
match constraint {
280284
TableConstraint::PrimaryKey { name, columns, .. } => {

0 commit comments

Comments
 (0)