Feature Request: Replication capability
- Dominant language
- Go
- Stars
- 2.1k
- Forks
- 73
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 129
Description
Copied from [original request](https://github.com/dolthub/doltgresql/issues/44#issuecomment-1854163957):
I really want to share our intended use case with doltgres just so you know how interested I am in this project: we do claim management and processing for insurers and data changes are part of our core data structures. At any given time we need to allow claim handlers to view those data to make decisions as well as others to view audit logs. Such use case may not be so unique, except we're using GraphQL with Hasura (been using it in our org for 3 years now) which enables instant GraphQL from postgres. With the combination of those, we'll build something like this:
```sql
create table employees (
id int8,
last_name text,
first_name text,
primary key(id));
insert into employees values
(0, 'Sehn', 'Tim'),
(1, 'Hendriks', 'Brian'),
(2, 'Son','Aaron'),
(3, 'Fitzgerald', 'Brian');
select * from employees where first_name='Brian';
+------+------------+------------+
| id | last_name | first_name |
+------+------------+------------+
| 1 | Hendriks | Brian |
| 3 | Fitzgerald | Brian |
+------+------------+------------+
select * from dolt_diff_employees;
+--------------+---------------+-------+-----------+----------------+----------------+-----------------+---------+----------------------------------+-------------------------+-----------+
| to_last_name | to_first_name | to_id | to_commit | to_commit_date | from_last_name | from_first_name | from_id | from_commit | from_commit_date | diff_type |
+--------------+---------------+-------+-----------+----------------+----------------+-----------------+---------+----------------------------------+-------------------------+-----------+
| Sehn | Tim | 0 | WORKING | NULL | NULL | NULL | NULL | ne182jemgrlm8jnjmoubfqsstlfi1s98 | 2022-06-07 16:35:49.277 | added |
+--------------+---------------+-------+-----------+----------------+----------------+-----------------+---------+----------------------------------+-------------------------+-----------+
call dolt_checkout('-b','modifications');
update employees SET first_name='Timothy' where first_name='Tim';
call dolt_commit('-am', 'Modifications on a branch');
select * from dolt_diff('main', 'modifications', 'employees');
+--------------+---------------+-------+---------------+-------------------------+----------------+-----------------+---------+-------------+-------------------------+-----------+
| to_last_name | to_first_name | to_id | to_commit | to_commit_date | from_last_name | from_first_name | from_id | from_commit | from_commit_date | diff_type |
+--------------+---------------+-------+---------------+-------------------------+----------------+-----------------+---------+-------------+-------------------------+-----------+
| Sehn | Timothy | 0 | modifications | 2022-06-07 16:41:49.847 | Sehn | Tim | 0 | main | 2022-06-07 16:39:32.066 | modified |
| Wilkins | Daylon | 4 | modifications | 2022-06-07 16:41:49.847 | NULL | NULL | NULL | main | 2022-06-07 16:39:32.066 | added |
+--------------+---------------+-------+---------------+-------------------------+----------------+-----------------+---------+-------------+-------------------------+-----------+
```
Graphql-join this data with the employees table, I'll get this Graph:
```graphql
query test {
employees { // array of objects
id
last_name
first_name
dolt_diff_employees_modifications { // array of objects
to_last_name
to_first_name
to_id
to_commit
to_commit_date
from_last_name
from_first_name
from_id
from_commit
from_commit_date
diff_type
}
dolt_diff_employees_other_modifications { // array of objects
to_last_name
to_first_name
to_id
to_commit
to_commit_date
from_last_name
from_first_name
from_id
from_commit
from_commit_date
diff_type
}
}
}
```
Contributor guide
Assessment
This issue has not been assessed yet.