Propagate changes about revert mechanism and naming on migration 12

This commit is contained in:
Alexandre Aubin 2019-09-10 17:15:01 +02:00
parent dc7b8d1faa
commit ec3856a25c

View file

@ -10,12 +10,7 @@ class MyMigration(Migration):
all_hba_files = glob.glob("/etc/postgresql/*/*/pg_hba.conf")
def forward(self):
def run(self):
for filename in self.all_hba_files:
pg_hba_in = read_file(filename)
write_to_file(filename, re.sub(r"local(\s*)all(\s*)all(\s*)password", "local\\1all\\2all\\3md5", pg_hba_in))
def backward(self):
for filename in self.all_hba_files:
pg_hba_in = read_file(filename)
write_to_file(filename, re.sub(r"local(\s*)all(\s*)all(\s*)md5", "local\\1all\\2all\\3password", pg_hba_in))