-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
post-migrate hook to Dolt commit django migrations
- Loading branch information
1 parent
b81a8da
commit 2732434
Showing
3 changed files
with
25 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from django.db import connection | ||
|
||
|
||
def dolt_autocommit_migration(sender, **kwargs): | ||
msg = "created dolt commit for database migration" | ||
author = "nautobot <nautobot@ntc.com>" | ||
with connection.cursor() as cursor: | ||
cursor.execute("SELECT dolt_add('-A') FROM dual;") | ||
cursor.execute( | ||
f""" | ||
SELECT dolt_commit( | ||
'--all', | ||
'--allow-empty', | ||
'--message', '{msg}', | ||
'--author', '{author}') | ||
FROM dual;""" | ||
) |
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