53 lines
607 B
Markdown
53 lines
607 B
Markdown
|
|
# Dump schema
|
|
|
|
```bash
|
|
cat << EOF | sqlite3 db/photos.db > photos.schema
|
|
.schema
|
|
EOF
|
|
```
|
|
|
|
# Edit schema
|
|
|
|
```bash
|
|
nano photos.schema
|
|
```
|
|
|
|
# Backup database
|
|
|
|
```bash
|
|
cp db/photos.db photos.db.bk
|
|
```
|
|
|
|
# For the table you want to modify
|
|
|
|
## Backup the table
|
|
|
|
```bash
|
|
cat << EOF | sqlite3 db/photos.db
|
|
.output faces.dump
|
|
.dump faces
|
|
.quit
|
|
EOF
|
|
```
|
|
|
|
## Drop the table
|
|
|
|
```bash
|
|
cat << EOF | sqlite3 db/photos.db
|
|
drop table faces
|
|
EOF
|
|
```
|
|
|
|
## Create the table with the modified schema
|
|
|
|
```bash
|
|
cat photos.schema | sqlite3 db/photos.db
|
|
```
|
|
|
|
## Re-populate the table
|
|
|
|
```bash
|
|
cat faces.dump | sqlite3 db/photos.db
|
|
```
|