Merge branch 'master' into master-android

This commit is contained in:
Evgeny Poberezkin committed 2025-02-03 21:02:51 +00:00
commit 234764e7fb
229 files changed
+30247 -6022

No files matched your search

+85
View File
@@ -0,0 +1,85 @@
# Transfer data from SQLite to Postgres database
1. \* Decrypt SQLite database if it is encrypted.
```sh
sqlcipher encrypted_simplex_v1_agent.db
```
```sql
PRAGMA key = 'password';
ATTACH DATABASE 'simplex_v1_agent.db' AS plaintext KEY '';
SELECT sqlcipher_export('plaintext');
DETACH DATABASE plaintext;
```
Repeat for `simplex_v1_chat.db`.
2. Prepare Postgres database.
Build `simplex-chat` executable with `client_postgres` flag and run it to initialize new Postgres chat database.
This should create `simplex_v1` database with `simplex_v1_agent_schema` and `simplex_v1_chat_schema` schemas, and `migrations` tables populated. Some tables would have initialization data - it will be truncated via pgloader command in next step.
3. Load data from decrypted SQLite databases to Postgres database via pgloader.
Install pgloader and add it to PATH.
```sh
SQLITE_DBPATH='simplex_v1_agent.db' POSTGRES_CONN='postgres://simplex@/simplex_v1' POSTGRES_SCHEMA='simplex_v1_agent_schema' pgloader --on-error-stop sqlite.load
SQLITE_DBPATH='simplex_v1_chat.db' POSTGRES_CONN='postgres://simplex@/simplex_v1' POSTGRES_SCHEMA='simplex_v1_chat_schema' pgloader --on-error-stop sqlite.load
```
4. Update sequences for Postgres tables.
```sql
DO $$
DECLARE
rec RECORD;
BEGIN
EXECUTE 'SET SEARCH_PATH TO simplex_v1_agent_schema';
FOR rec IN
SELECT
table_name,
column_name,
pg_get_serial_sequence(table_name, column_name) AS seq_name
FROM
information_schema.columns
WHERE
table_schema = 'simplex_v1_agent_schema'
AND identity_generation = 'ALWAYS'
LOOP
EXECUTE format(
'SELECT setval(%L, (SELECT MAX(%I) FROM %I))',
rec.seq_name, rec.column_name, rec.table_name
);
END LOOP;
END $$;
```
Repeat for `simplex_v1_chat_schema`.
5. Compare number of rows between Postgres and SQLite tables.
To check number of rows for all tables in Postgres database schema run:
```sql
WITH tbl AS (
SELECT table_schema, table_name
FROM information_schema.Tables
WHERE table_name NOT LIKE 'pg_%'
AND table_schema IN ('simplex_v1_agent_schema')
)
SELECT
table_schema AS schema_name,
table_name,
(xpath('/row/c/text()', query_to_xml(
format('SELECT count(*) AS c FROM %I.%I', table_schema, table_name), false, true, ''
)))[1]::text::int AS records_count
FROM tbl
ORDER BY records_count DESC;
```
Repeat for `simplex_v1_chat_schema`.
+20
View File
@@ -0,0 +1,20 @@
LOAD DATABASE
FROM {{SQLITE_DBPATH}}
INTO {{POSTGRES_CONN}}
WITH include no drop,
truncate,
disable triggers,
create no tables,
create no indexes,
-- pgloader implementation doesn't find "GENERATED ALWAYS AS IDENTITY" sequences,
-- instead we reset sequences manually via custom query after load
reset no sequences,
data only
EXCLUDING TABLE NAMES LIKE 'migrations', 'sqlite_sequence'
SET work_mem to '16MB',
maintenance_work_mem to '512 MB',
search_path to '{{POSTGRES_SCHEMA}}'
;
@@ -38,6 +38,25 @@
</description>
<releases>
<release version="6.2.4" date="2025-01-14">
<url type="details">https://simplex.chat/blog/20241210-simplex-network-v6-2-servers-by-flux-business-chats.html</url>
<description>
<p>New in v6.2.1-4:</p>
<ul>
<li>important fixes</li>
<li>offer to "fix" encryption when calling or making direct connection with member.</li>
<li>broken layout.</li>
<li>option to enable debug logs (disabled by default).</li>
<li>show who reacted in direct chats.</li>
</ul>
<p>New in v6.2:</p>
<ul>
<li>SimpleX Chat and Flux made an agreement to include servers operated by Flux into the app – to improve metadata privacy.</li>
<li>Business chats – your customers privacy.</li>
<li>Improved user experience in chats: open on the first unread, jump to quoted messages, see who reacted.</li>
</ul>
</description>
</release>
<release version="6.2.3" date="2024-12-26">
<url type="details">https://simplex.chat/blog/20241210-simplex-network-v6-2-servers-by-flux-business-chats.html</url>
<description>
+1 -1
View File
@@ -1,5 +1,5 @@
{
"https://github.com/simplex-chat/simplexmq.git"."dadf6ec5b67ee49b0f18ac4aecdce0d0be26786d" = "0rgnqqkvhgd0a3vncbfx75sqlnd6spgyi2nj303pifdh9hza7k57";
"https://github.com/simplex-chat/simplexmq.git"."45373e7f1f755ac3dfaa3f8efa03d8dc7b2d69ce" = "0rz1n3hl59b6khnhrvwhlwdrmrb9fm291i3h03ddlqkrpg1x36m6";
"https://github.com/simplex-chat/hs-socks.git"."a30cc7a79a08d8108316094f8f2f82a0c5e1ac51" = "0yasvnr7g91k76mjkamvzab2kvlb1g5pspjyjn2fr6v83swjhj38";
"https://github.com/simplex-chat/direct-sqlcipher.git"."f814ee68b16a9447fbb467ccc8f29bdd3546bfd9" = "1ql13f4kfwkbaq7nygkxgw84213i0zm7c1a8hwvramayxl38dq5d";
"https://github.com/simplex-chat/sqlcipher-simple.git"."a46bd361a19376c5211f1058908fc0ae6bf42446" = "1z0r78d8f0812kxbgsm735qf6xx8lvaz27k1a0b4a2m0sshpd5gl";