Skip to content

Commit

Permalink
⬆️ upgrade dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Odonno committed Aug 12, 2024
1 parent 44dea74 commit f70fcb7
Show file tree
Hide file tree
Showing 11 changed files with 126 additions and 111 deletions.
152 changes: 81 additions & 71 deletions Cargo.lock

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,29 @@ edition = "2021"
[dependencies]
chrono = "0.4.38"
chrono-human-duration = "0.1.1"
clap = { version = "4.5.4", features = ["derive"] }
cli-table = "0.4.7"
clap = { version = "4.5.15", features = ["derive"] }
cli-table = "=0.4.7"
color-eyre = "0.6.3"
convert_case = "0.6.0"
diffy = "0.3.0"
diffy = "0.4.0"
fs_extra = "1.3.0"
include_dir = "0.7.3"
itertools = "0.12.1"
include_dir = "0.7.4"
itertools = "0.13.0"
names = { version = "0.14.0", default-features = false }
regex = "1.10.4"
rust-ini = "0.21.0"
serde = { version = "1.0.198", features = ["derive"] }
serde_json = "1.0.116"
sqlparser = "0.45.0"
surrealdb = { version = "1.5.0", features = ["protocol-http", "jwks", "sql2"] }
tokio = { version = "1.37.0", features = ["macros"] }
regex = "1.10.6"
rust-ini = "0.21.1"
serde = { version = "1.0.206", features = ["derive"] }
serde_json = "1.0.124"
sqlparser = "0.49.0"
surrealdb = { version = "1.5.4", features = ["protocol-http", "jwks", "sql2"] }
tokio = { version = "1.39.2", features = ["macros"] }

[dev-dependencies]
assert_cmd = "2.0.14"
assert_fs = "1.1.1"
assert_cmd = "2.0.16"
assert_fs = "1.1.2"
dir-diff = "0.3.3"
predicates = "3.1.0"
predicates = "3.1.2"
pretty_assertions = "1.4.0"
serial_test = "3.0.0"
serial_test = "3.1.1"
tokio-test = "0.4.4"

4 changes: 2 additions & 2 deletions schema-files/mssql/create_table.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ CREATE TABLE Post (
[Title] NVARCHAR(255),
[Content] TEXT,
[Status] NVARCHAR(50),
[CreatedAt] DATETIME,
)
[CreatedAt] DATETIME
);
2 changes: 1 addition & 1 deletion schema-files/mssql/create_table_with_index.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CREATE TABLE DailySales (
[Id] UNIQUEIDENTIFIER NOT NULL PRIMARY KEY,
[Value] DECIMAL(10, 2) NOT NULL,
[Date] DATE NOT NULL,
[Date] DATE NOT NULL
);

CREATE INDEX IX_DailySales_Sales ON DailySales (Date);
2 changes: 1 addition & 1 deletion schema-files/mssql/create_table_with_many_types.sql
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ CREATE TABLE Test (
[DateTime] DATETIME,
[Timestamp] TIMESTAMP,
[Json] JSON,
[Variant] SQL_VARIANT,
[Variant] SQL_VARIANT
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ CREATE TABLE Product (
[Id] UNIQUEIDENTIFIER NOT NULL PRIMARY KEY,
[Name] NVARCHAR(255),
[Color] NVARCHAR(255),
[Size] NVARCHAR(255),
[Size] NVARCHAR(255)
);

CREATE INDEX Vote_Name_Color_Size ON Product (Name, Color, Size);
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CREATE TABLE Vote (
[Id] UNIQUEIDENTIFIER NOT NULL PRIMARY KEY,
[Username] NVARCHAR(255),
[Movie] NVARCHAR(255),
[Movie] NVARCHAR(255)
);

CREATE UNIQUE INDEX Vote_Username_Movie_Unique ON Vote (Username, Movie);
2 changes: 1 addition & 1 deletion schema-files/mssql/create_table_with_not_null.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ CREATE TABLE Post (
[Title] NVARCHAR(255) NOT NULL,
[Content] TEXT NOT NULL,
[Status] NVARCHAR(50) NOT NULL,
[CreatedAt] DATETIME NOT NULL,
[CreatedAt] DATETIME NOT NULL
)
6 changes: 3 additions & 3 deletions schema-files/mssql/create_table_with_relations.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ CREATE TABLE Post (
[Title] NVARCHAR(255) NOT NULL,
[Content] TEXT NOT NULL,
[Status] NVARCHAR(50) NOT NULL,
[CreatedAt] DATETIME NOT NULL,
[CreatedAt] DATETIME NOT NULL
);

CREATE TABLE User (
[Id] UNIQUEIDENTIFIER NOT NULL PRIMARY KEY,
[Username] NVARCHAR(255) NOT NULL UNIQUE,
[Email] NVARCHAR(255) NOT NULL UNIQUE,
[Password] NVARCHAR(255) NOT NULL,
[RegisteredAt] DATETIME NOT NULL,
[RegisteredAt] DATETIME NOT NULL
);

CREATE TABLE Comment (
Expand All @@ -21,5 +21,5 @@ CREATE TABLE Comment (
[User] UNIQUEIDENTIFIER NOT NULL,
[Post] UNIQUEIDENTIFIER NOT NULL,
FOREIGN KEY (User) REFERENCES User(Id),
FOREIGN KEY (Post) REFERENCES Post(Id),
FOREIGN KEY (Post) REFERENCES Post(Id)
);
2 changes: 1 addition & 1 deletion schema-files/mssql/create_table_with_unique_index.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ CREATE TABLE User (
[Username] NVARCHAR(255) NOT NULL UNIQUE,
[Email] NVARCHAR(255) NOT NULL UNIQUE,
[Password] NVARCHAR(255) NOT NULL,
[RegisteredAt] DATETIME NOT NULL,
[RegisteredAt] DATETIME NOT NULL
);
31 changes: 18 additions & 13 deletions src/scaffold/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,15 @@ fn convert_ast_to_surrealdb_schema(

for statement in ast {
match statement {
sqlparser::ast::Statement::CreateTable {
name,
columns,
constraints,
..
} => {
sqlparser::ast::Statement::CreateTable(create_table) => {
let sqlparser::ast::CreateTable {
name,
columns,
constraints,
..
} = create_table;
//let sqlparser::ast::Table { table_name, .. } = table;

let mut line_definitions = SurrealdbSchemaDefinition::new();

let table_name = name.to_string();
Expand Down Expand Up @@ -320,13 +323,15 @@ fn convert_ast_to_surrealdb_schema(

tables.insert(table_name, line_definitions);
}
sqlparser::ast::Statement::CreateIndex {
name,
table_name,
columns,
unique,
..
} => {
sqlparser::ast::Statement::CreateIndex(create_index) => {
let sqlparser::ast::CreateIndex {
name,
table_name,
columns,
unique,
..
} = create_index;

let table_name = match table_name.0.first() {
Some(table_name) => table_name.value.to_string(),
None => {
Expand Down

0 comments on commit f70fcb7

Please sign in to comment.