Closed frcroth closed 3 years ago
Closes #26. Dates are automatically set to the current date on creation, updated date is automatically set on update statements.
Unfortunately I can not run the tests locally with the new 2 database setup.
Why can't you run the tests locally?
Closes #26. Dates are automatically set to the current date on creation, updated date is automatically set on update statements.
Unfortunately I can not run the tests locally with the new 2 database setup.
Why can't you run the tests locally?
Does the procedure described here not work?
I added a test that should not fail (the behavior works in production) but fails.
Well if you @sirkrypt0 have any idea why the test fails, I'm happy to change this. It seems the trigger is not triggered in the test database for some reason. Tried debugging this but to no avail.
Well if you @sirkrypt0 have any idea why the test fails, I'm happy to change this. It seems the trigger is not triggered in the test database for some reason. Tried debugging this but to no avail.
The database connection in the tests does never commit the changes to the database directly. This might be the issue here, as the database would only fill the columns once the data is committed.
Well if you @sirkrypt0 have any idea why the test fails, I'm happy to change this. It seems the trigger is not triggered in the test database for some reason. Tried debugging this but to no avail.
The database connection in the tests does never commit the changes to the database directly. This might be the issue here, as the database would only fill the columns once the data is committed.
I did some research and think this is actually not the problem here. The triggers should run once the event, which is an update in this case, fires, regardless if there is a transaction or not.
The trigger is executed correctly. This can be tested by changing the last_upd_trig()
to also change the username like NEW.username := 'updated';
. Running the test afterwards correctly changes the username. The problem is, that current_timestamp
returns the current date and time with time zone, which is the time when the transaction starts. All database operations in a single test run in a single transaction, thus the current_timestamp
is the same for all operations on a test connection.
Closes #26. Dates are automatically set to the current date on creation, updated date is automatically set on update statements.
Unfortunately I can not run the tests locally with the new 2 database setup.