From cdabe3ddc0d3e9b5de2bec1dd5525ef02cd71681 Mon Sep 17 00:00:00 2001 From: Ashwin Thanaraj <37061471+ashwin1111@users.noreply.github.com> Date: Tue, 24 Dec 2024 15:05:25 +0530 Subject: [PATCH] feat: Add replication and publication (#419) * feat: Add replication and publication * fix lint --- .gitignore | 3 +- .../migrations/0023_auto_20241224_0846.py | 30 +++++++++++++++++++ deploy_dump.sh | 11 +++++++ 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 apps/fyle/migrations/0023_auto_20241224_0846.py create mode 100644 deploy_dump.sh diff --git a/.gitignore b/.gitignore index ef9af551..e58df17e 100644 --- a/.gitignore +++ b/.gitignore @@ -159,4 +159,5 @@ cache.db-journal # Dev files fyle_integrations_platform_connector/ fylesdk/ -fyle_accounting_mappings/ \ No newline at end of file +fyle_accounting_mappings/ +commits.csv diff --git a/apps/fyle/migrations/0023_auto_20241224_0846.py b/apps/fyle/migrations/0023_auto_20241224_0846.py new file mode 100644 index 00000000..44acb0ab --- /dev/null +++ b/apps/fyle/migrations/0023_auto_20241224_0846.py @@ -0,0 +1,30 @@ +# Generated by Django 3.2.14 on 2024-12-24 08:46 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('fyle', '0022_support_split_expense_grouping'), + ] + + operations = [ + migrations.RunSQL( + sql=""" + create publication events for all tables; + DO $$ + DECLARE + tbl RECORD; + BEGIN + FOR tbl IN + SELECT table_schema, table_name + FROM information_schema.tables + WHERE table_type = 'BASE TABLE' AND table_schema = 'public' + LOOP + EXECUTE format('ALTER TABLE %I.%I REPLICA IDENTITY FULL', tbl.table_schema, tbl.table_name); + END LOOP; + END $$; + """, + ), + ] diff --git a/deploy_dump.sh b/deploy_dump.sh new file mode 100644 index 00000000..bf2a3c89 --- /dev/null +++ b/deploy_dump.sh @@ -0,0 +1,11 @@ +if [ -z "$1" ]; then + echo "Usage: sh $0 '2024-12-09'" + exit 1 +fi + +base_url="https://github.com/fylein/fyle-xero-api/commit" +branch_name=$(git rev-parse --abbrev-ref HEAD) + +git log --since="$1" --pretty=format:"$base_url/%H,%an,%ad,%s,$branch_name,xero-api" > commits.csv + +open commits.csv