6fefc992bd05c09f45ef8c63ae5cfc1e74a43f6a
nocodb/reset_id_pkey.md
... | ... | @@ -1,38 +1,28 @@ |
1 | - |
|
2 | 1 | ``` |
3 | -/ # psql -d skydive -U skydive |
|
2 | +/ # psql -d db -U db |
|
4 | 3 | psql (17.2) |
5 | 4 | Type "help" for help. |
6 | 5 | |
7 | -skydive=> \dt |
|
8 | - List of relations |
|
9 | - Schema | Name | Type | Owner |
|
10 | ----------+------------------------+-------+--------- |
|
11 | - skydive | Events | table | skydive |
|
12 | - skydive | FTBLP_tunnel_timesheet | table | skydive |
|
13 | - skydive | VFS_draw_FAI_indoor | table | skydive |
|
14 | - skydive | epheo_logbook | table | skydive |
|
15 | -(4 rows) |
|
16 | 6 | |
17 | -skydive=> ALTER TABLE epheo_logbook ADD COLUMN new_id SERIAL; |
|
7 | +skydive=> ALTER TABLE db ADD COLUMN new_id SERIAL; |
|
18 | 8 | ALTER TABLE |
19 | -skydive=> ALTER TABLE epheo_logbook ADD COLUMN new_id SERIAL; |
|
9 | +skydive=> ALTER TABLE db ADD COLUMN new_id SERIAL; |
|
20 | 10 | ALTER TABLE |
21 | 11 | |
22 | 12 | skydive=> SELECT conname |
23 | 13 | skydive-> FROM pg_constraint |
24 | -skydive-> WHERE conrelid = 'epheo_logbook'::regclass AND contype = 'p'; |
|
14 | +skydive-> WHERE conrelid = 'db'::regclass AND contype = 'p'; |
|
25 | 15 | conname |
26 | 16 | -------------- |
27 | - logbook_pkey |
|
17 | + db_pkey |
|
28 | 18 | (1 row) |
29 | 19 | |
30 | -skydive=> ALTER TABLE epheo_logbook DROP CONSTRAINT logbook_pkey; |
|
20 | +skydive=> ALTER TABLE db DROP CONSTRAINT logbook_pkey; |
|
31 | 21 | ALTER TABLE |
32 | -skydive=> ALTER TABLE epheo_logbook DROP COLUMN id; |
|
22 | +skydive=> ALTER TABLE db DROP COLUMN id; |
|
33 | 23 | ALTER TABLE |
34 | -skydive=> ALTER TABLE epheo_logbook RENAME COLUMN new_id TO id; |
|
24 | +skydive=> ALTER TABLE db RENAME COLUMN new_id TO id; |
|
35 | 25 | ALTER TABLE |
36 | -skydive=> ALTER TABLE epheo_logbook ADD PRIMARY KEY (id); |
|
26 | +skydive=> ALTER TABLE db ADD PRIMARY KEY (id); |
|
37 | 27 | ALTER TABLE |
38 | 28 | ``` |
... | ... | \ No newline at end of file |