diff --git a/scripts/install_postgres17.py b/scripts/install_postgres17.py new file mode 100644 index 0000000..9452ad7 --- /dev/null +++ b/scripts/install_postgres17.py @@ -0,0 +1,47 @@ + +#!/usr/bin/env python3 +import subprocess +import sys + +def run(cmd, check=True): + print(f"$ {cmd}") + result = subprocess.run(cmd, shell=True, check=check) + return result + +def main(): + print("==> Installing dependencies...") + run("apt install -y curl ca-certificates") + + print("\n==> Setting up PostgreSQL signing key...") + run("install -d /usr/share/postgresql-common/pgdg") + run( + "curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail " + "https://www.postgresql.org/media/keys/ACCC4CF8.asc" + ) + + print("\n==> Detecting Ubuntu codename...") + codename = subprocess.check_output("lsb_release -cs", shell=True).decode().strip() + print(f" Detected: {codename}") + + print("\n==> Adding PGDG apt repository...") + repo_line = ( + f"deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] " + f"https://apt.postgresql.org/pub/repos/apt {codename}-pgdg main" + ) + with open("/etc/apt/sources.list.d/pgdg.list", "w") as f: + f.write(repo_line + "\n") + print(f" Written: {repo_line}") + + print("\n==> Updating apt package lists...") + run("apt update") + + print("\n==> Installing PostgreSQL 17...") + run("apt install -y postgresql-17") + + print("\n✅ PostgreSQL 17 installed successfully.") + +if __name__ == "__main__": + if subprocess.run("id -u", shell=True, capture_output=True).stdout.strip() != b"0": + print("This script must be run as root. Try: sudo python3 install_postgres17.py") + sys.exit(1) + main() \ No newline at end of file diff --git a/wcoa/migrations/0030_ohidashboard_body.py b/wcoa/migrations/0030_ohidashboard_body.py index 0d02dc7..8f1039f 100644 --- a/wcoa/migrations/0030_ohidashboard_body.py +++ b/wcoa/migrations/0030_ohidashboard_body.py @@ -15,7 +15,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='ohidashboard', name='body', - field=wagtail.fields.StreamField([('content', wagtail.blocks.RichTextBlock(required=False))], default='{"blocks":[{"key":"j9bes","text":"one","type":"ordered-list-item","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}},{"key":"e9r3j","text":"","type":"ordered-list-item","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}}],"entityMap":{}}', use_json_field=True), + field=wagtail.fields.StreamField([('content', wagtail.blocks.RichTextBlock(required=False))], default=list, use_json_field=True), preserve_default=False, ), ]