Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dolt dump should include views, triggers, and procedures #3225

Merged
merged 10 commits into from
Apr 18, 2022
Merged

Conversation

jycor
Copy link
Contributor

@jycor jycor commented Apr 14, 2022

fix for: #3159
instead of dumping certain dolt tables, create the views, triggers, and procedures.

@jycor jycor requested a review from zachmu April 15, 2022 20:30
Copy link
Member

@zachmu zachmu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -147,6 +148,66 @@ func InsertStatementPrefix(tableName string, tableSch schema.Schema) (string, er
return b.String(), nil
}

// SqlRowAsCreateProcStmt Converts a Row into either a CREATE PROCEDURE statement
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mention that this expectes a row from the dolt_procedures table

}

// SqlRowAsCreateFragStmt Converts a Row into either a CREATE TRIGGER or CREATE VIEW statement
func SqlRowAsCreateFragStmt(r sql.Row) (string, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mention that this needs a row from the dolt_schemas table

@@ -160,6 +159,61 @@ teardown() {
dolt sql -q "CREATE VIEW view2 AS SELECT y FROM b;"
dolt sql -q "CREATE TRIGGER trigger2 AFTER INSERT ON a FOR EACH ROW INSERT INTO b VALUES (new.x * 2);"
dolt sql -q "INSERT INTO a VALUES (2);"
dolt sql -q "CREATE PROCEDURE p1 (in x int) select x from dual"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need a test for a trigger that uses precedes or follows syntax:

https://dev.mysql.com/doc/refman/8.0/en/create-trigger.html

@jycor jycor merged commit 8ceb83d into main Apr 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants