You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+38Lines changed: 38 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,6 +36,18 @@ alter user postgres with superuser;
36
36
create database "resell-dev";
37
37
```
38
38
39
+
Use the \l command to see if the "resell-dev" is owned by user postgres. If
40
+
instead it is owned by another root user, drop the database via:
41
+
```bash
42
+
drop database "resell-dev";
43
+
```
44
+
and login to psql via
45
+
```bash
46
+
psql postgres postgres
47
+
```
48
+
. Then, create the database again, and it should be owned by user postgres.
49
+
50
+
39
51
## Connecting to DB
40
52
41
53
In order to connect to the database, follow these steps:
@@ -63,6 +75,32 @@ To create/update the database objects, run:
63
75
npm run db:migrate
64
76
```
65
77
78
+
## Migration debugging last resort
79
+
80
+
If you are encountering migrations errors, use this as a last resort
81
+
1. Log into psql and run
82
+
```bash
83
+
drop database "resell-dev"
84
+
```
85
+
WARNING: This will delete all data in your database as well. Make sure you do not have any important data in your database.
86
+
87
+
2. Create the database again via.
88
+
```bash
89
+
create database "resell-dev"
90
+
```
91
+
92
+
3. Delete all of the migration files in the "migrations" folder
93
+
94
+
4. Create a new migration file titled "init" via.
95
+
```bash
96
+
npm run db:migrate:generate init
97
+
```
98
+
99
+
5. Run the migration
100
+
```bash
101
+
npm run db:migrate
102
+
```
103
+
66
104
## Seeding Data for Development Environment
67
105
68
106
This project includes a mechanism for seeding consistent data for the development environment using TypeORM and typeorm-seeding. The seeders generate users, posts, feedback, reviews, reports, and requests, ensuring all developers work with the same data set.
0 commit comments