Naposledy aktivní 1729300119

Neon-readme-13.sh Raw
1# create branch named migration_check
2> cargo neon timeline branch --branch-name migration_check
3Created timeline 'b3b863fa45fa9e57e615f9f2d944e601' at Lsn 0/16F9A00 for tenant: 9ef87a5bf0d92544f6fafeeb3239695c. Ancestor timeline: 'main'
4
5# check branches tree
6> cargo neon timeline list
7(L) main [de200bd42b49cc1814412c7e592dd6e9]
8(L) ┗━ @0/16F9A00: migration_check [b3b863fa45fa9e57e615f9f2d944e601]
9
10# create postgres on that branch
11> cargo neon endpoint create migration_check --branch-name migration_check
12
13# start postgres on that branch
14> cargo neon endpoint start migration_check
15Starting new endpoint migration_check (PostgreSQL v14) on timeline b3b863fa45fa9e57e615f9f2d944e601 ...
16Starting postgres at 'postgresql://cloud_admin@127.0.0.1:55434/postgres'
17
18# check the new list of running postgres instances
19> cargo neon endpoint list
20 ENDPOINT ADDRESS TIMELINE BRANCH NAME LSN STATUS
21 main 127.0.0.1:55432 de200bd42b49cc1814412c7e592dd6e9 main 0/16F9A38 running
22 migration_check 127.0.0.1:55434 b3b863fa45fa9e57e615f9f2d944e601 migration_check 0/16F9A70 running
23
24# this new postgres instance will have all the data from 'main' postgres,
25# but all modifications would not affect data in original postgres
26> psql -p 55434 -h 127.0.0.1 -U cloud_admin postgres
27postgres=# select * from t;
28 key | value
29-----+-------
30 1 | 1
31(1 row)
32
33postgres=# insert into t values(2,2);
34INSERT 0 1
35
36# check that the new change doesn't affect the 'main' postgres
37> psql -p 55432 -h 127.0.0.1 -U cloud_admin postgres
38postgres=# select * from t;
39 key | value
40-----+-------
41 1 | 1
42(1 row)