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
- Weird permission failure
when creating an account I use following methods: ``` Future<void> register(String email, String password, String username) async { final user = await accoun...
- Relation Question
How do I create a relation from table y to an others x.$id. in my example I have a users table where I use Appwrites unique User IDs and I want other tables fo...
- Unknown attribute type: varchar / text
Since the `string` type is deprecated I tried using `varchar` and `text` in some newer tables, but when running `appwrite pull tables && appwrite types ./src/li...