Auto-update value in Postgres/TypeOrm - postgresql

I have a table called customers which has a column called pin. A customer can generate this pin(from app) while making an offline purchase and give that pin at the POS/Kiosk to establish identity. This pin gets generated fresh every time a customer requests for it and is stored in the DB(in the customer table under column - pin) and is set to "null" again after payment confirmation.
However, if the customer generates a pin and does not make a purchase, the pin remains in the DB. I would like to know if there is any way to update this value to null after a certain time period without having to run a cron job or something or the use of a timestamp(if I should use a timestamp please let me know how).
I am using Postgres with TypeOrm on NestJs.
Any suggestions are welcome. Thank you.

Related

Verify Data INSERT INTO QUERY

Using postgresql-14 with pgadmin4
The task is vague but requests that I insert the data into a new table and then verify the data. I want to believe there is some "standard" or process to verify that the data was moved correctly and is intact, is there such a thing? I'm not sure how to "show" that the data is verified as correct in the new table.
For this insert:
INSERT INTO car_detail(id, make, model, price, year)
SELECT dealership_stock.id AS id,
manufacturers.make AS make,
models.model_name AS model,
price_sheet.price AS price,
model_years.year AS year,
FROM dealership_stock
INNER JOIN.... etc.
TIA - it seems like a simple and logical task, but I am baffled on how to execute and prove it.
Dai and Bjarni were correct - verification isn't required in the code. The requirement was implying that the dataset would be viewed and confirmed that the data was present in the new table. And here I had hoped to learn of some fancy new command to verify data and instead am taking Belayer's comment to heart that I need to keep asking questions until I understand the requirements! Thanks everyone!

How do I setup a Tableau alert for when a table contains data?

I have a SQL query that usually results in zero records. Sometimes this query does show data and in those cases I need to send out an alert so that the responsible person can look at the table asap. Since there is normally not any data I am unable to "select a numeric axis" to create an alert. So far I've tried creating a calculated field: IF ISNULL(ID) THEN 0 ELSE 1 END and using that field as the numeric axis. Unfortunately, this did not resolve my issue. How can I setup this sort of alert in Tableau?
Use subscriptions with the 'Don't send if view is empty' option selected-
So, when data is present, run the subscription, else do not send.

oracle form ''you cannot update this record''

I have a procedure in which I get values from different tables and calculate a certain decimal number. After that i try to post it on a form text-field which is a database item (update and insert allowed on the settings of block and item). everything works fine but the result wont show on the item and won't save in the database field. I get the error
"you cannot update this record".
Can someone help? i have been working on it for two days now and can't find anything.
Did you check if your user has update access on the table?
Check also if there are database triggers on the table that prevents you from updating the record.

Laravel 5.1 Reset Password Function; user's email is in a different table

I have a question regarding Laravel's Reset Password function. I have thoroughly searched for a possible solution and could not find one. Moreover, I tried to scrutinize the code and manually implement it, but failed miserably because of the nesting. (I'm new to Laravel).
According to Laravel's documentation, the user's email must be in the table user in order to work and the error code confirms it.
*Column not found: 1054 Unknown column 'email' in 'where clause' (SQL: select * from user where email = usermail#provider.com limit 1*
However, we do have the scenario that an user might have multiple email addresses, hence stored in a different table called user_email.
Does anybody have experience with this scenario and could take the time to enlighten me on this?
You have two Options:
Write your own password recovery system.
Let the user choose a primary e-mail and make a column on the users table which represents the primary e-mail adresse.

how to create auto atttendance system using filemaker

Hi i am new to filemaker, i am interested to learn and create an attendance system using filemaker. the way i like to do it is using the solution provided in filemaker ( Time Cards ). i would like my code to capture the timestamp of the user when ever the user enter his/her id and filemaker will automatically store the timestamp of that particular event. also the solution should be able to detect if it is already capture any previous time already entered by the same user. Sorry for my explaination. i hope its clear and understandable by you guys. Thanks in advance.
If the users are logging into the system (username and password), you can accomplish this by running a script on open (login).
That would work like:
go to tracking table (table made of timestamp and accountName field)
set error capture on
perform find - accountName = get(accountName)
if get(lastError) = 401 [this shows there are no records from this user], create new record, set field timestamp = get(currentTimestamp), set field accountName = get(accountName)
else [you can exit application, show dialog, or skip adding a new record if they entered previous data]
endif, then script whatever else you need to do onOpen.
If your users are entering in a temp field to log in against a user table, it's a similar step, you just need to grab $accountName as a variable to use in the find.