Is it a simplier way to migrate data (from no appwrite project) than inject to mariaDB directly knowing that we want to keep createdAt and updatedAt
You mean copied any other data into Appwrite directly to MariaDB?
The insertion of the value of _createdAt
and _updatedAt
is done through the PHP which means if you will directly import your data into MariaDB you can have the same createdAt and updatedAt you had before.
Yes, not find other ways
While we need to triggers function on database events too. We need to
- Inject data to mariaDB
- Loop over 100 000+ documents via appwrite rest API
- For each, fake an update, to trigger event
But it will update updatedAt
What is the need of step 2 and 3
Function don't trigger without use of appwrite api
Thinks it listen binlog but it's not the case :/
Ohh, got you. Let me see something.
Thinks we'll need to replicate function logic on migration script, to manually call this code, to keep updatedAt intact
If you want for this step to go you can do few things
Change Database.php file
Here https://github.com/utopia-php/database/blob/main/src/Database/Database.php#L2857C9-L2858
Appwrite's updating to the current time. You can override this file, You can look here https://discord.com/channels/564160730845151244/1121497324145868873/1121519354534711426
Custom document.
Create a document that have two updateAt fields Then trigger your function. Then run custom code in any language that will itereate over the documents and will set the _updateAt as your custom updateAt
If override appwrite code, thinks it's simplier to remove setAttribute
here : https://github.com/utopia-php/database/blob/main/src/Database/Database.php#L2530C48-L2530C48 that let ut set createdAt and updatedAt on createDocument API call to appwrite
This is one the creation, but yes.
Yes, with that not need to call updated after to trigger function, while function will be call on insertion
Ohh, Okay.
But... Thinks we'll not override appwrite file. We'll inject function code on migration script
- Inject data to mariaDB
- Select * from mariaDB, & reconstruct "appwrite object" (with $documentId, etc..)
- Inject it on fake function code
Thinks it's better
Instead of other option
I'll check if feature issue exist on github, to force createdAt and updatedAt
Thanks for your time @Binyamin . if you or other have other idea,, don't hesitate
Sounds good
👍
Recommended threads
- How to Avoid Double Requests in function...
I'm currently using Appwrite's `functions.createExecution` in my project. I want to avoid double requests when multiple actions (like searching or pagination) a...
- Edit ID of an existing collection
Hi there. Is it possible to edit an ID of an existing collection? Right now it looks impossible from AppWrite cloud at least.
- Seed db
hello there... is this correct way to seed appwrite