-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add if-exists clause to drop table (#1043)
- Loading branch information
1 parent
c12d506
commit af42b94
Showing
3 changed files
with
12 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
class Avram::Migrator::DropTableStatement | ||
def initialize(@table_name : TableName) | ||
def initialize(@table_name : TableName, @if_exists : Bool = false) | ||
end | ||
|
||
def build | ||
"DROP TABLE #{@table_name}" | ||
"DROP TABLE #{@if_exists ? "IF EXISTS " : ""}#{@table_name};" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters