Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // LineSeparator can be used to split migrations by an exact line match. This line // will be removed from the output. If left blank, it is not considered. It is defaulted // to blank so you will have to set it manually. // Use case: in MSSQL, it is convenient to separate commands by GO statements like in // SQL Query Analyzer. LineSeparator = "" )
Functions ¶
This section is empty.
Types ¶
type ParsedMigration ¶
type ParsedMigration struct { UpStatements []string DownStatements []string DisableTransactionUp bool DisableTransactionDown bool }
func ParseMigration ¶
func ParseMigration(r io.ReadSeeker) (*ParsedMigration, error)
Split the given sql script into individual statements.
The base case is to simply split on semicolons, as these naturally terminate a statement.
However, more complex cases like pl/pgsql can have semicolons within a statement. For these cases, we provide the explicit annotations 'StatementBegin' and 'StatementEnd' to allow the script to tell us to ignore semicolons.
Click to show internal directories.
Click to hide internal directories.