Skip to content

Implement Migrations API#5437

Closed
PineappleIOnic wants to merge 51 commits into
1.4.xfrom
feat-implement-transfers
Closed

Implement Migrations API#5437
PineappleIOnic wants to merge 51 commits into
1.4.xfrom
feat-implement-transfers

Conversation

@PineappleIOnic

@PineappleIOnic PineappleIOnic commented Apr 27, 2023

Copy link
Copy Markdown
Contributor

What does this PR do?

Implement Migrations API

Checklist

  • Have you read the Contributing Guidelines on issues?
  • If the PR includes a change to an API's metadata (desc, label, params, etc.), does it also include updated API specs and example docs?

Comment thread app/config/collections.php Outdated
Comment thread docs/examples/1.2.x/console-cli/examples/transfers/create-firebase-source.md Outdated
Comment thread src/Appwrite/Utopia/Response.php Outdated
Comment thread src/Appwrite/Utopia/Response/Model/Import.php
Comment thread src/Appwrite/Utopia/Response/Model/Import.php
],
[
'$id' => ID::custom('statusCounters'),
'type' => Database::VAR_STRING,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apply proper changes according to changes required in the response model. Both structures should be pretty similar.

Comment thread app/controllers/api/imports.php Outdated
Comment thread app/controllers/api/imports.php Outdated
Comment thread app/controllers/api/imports.php Outdated
Comment thread app/controllers/api/imports.php Outdated
Comment thread app/config/collections.php Outdated
Comment thread app/config/collections.php Outdated
'$id' => '_key_statusCounters',
'type' => Database::INDEX_KEY,
'attributes' => ['statusCounters'],
'lengths' => [Database::LENGTH_KEY],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

statusCounters attribute size is 3000, Only 255 chars (Database::LENGTH_KEY) will be indexes.
Please double-check if it is enough for your queries, can be up to 768 MAX.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't perform any queries on this attribute, we may be best off just not having a index for it

@stnguyen90 stnguyen90 added this to the 1.4.0 milestone May 25, 2023
@PineappleIOnic PineappleIOnic changed the title Implement Transfers API Implement Migrations API Jul 18, 2023
@PineappleIOnic PineappleIOnic changed the base branch from master to feat-db-pools July 18, 2023 09:21

@christyjacob4 christyjacob4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please address the comments

@abnegate abnegate left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, just a few comments on style and consistency. Let's merge in 1.4.x to bring it up to date and resolve conflicts as well

Comment thread app/controllers/api/migrations.php Outdated
Comment thread app/controllers/api/migrations.php
Comment thread app/controllers/api/migrations.php Outdated
Comment thread app/controllers/api/migrations.php Outdated
Comment thread app/controllers/api/migrations.php Outdated
Comment thread app/controllers/api/migrations.php Outdated
Comment on lines +373 to +399
// $migration = $dbForProject->createDocument('migrations', new Document([
// '$id' => ID::unique(),
// 'status' => 'pending',
// 'stage' => 'init',
// 'source' => Firebase::getName(),
// 'credentials' => [
// 'serviceAccount' => $serviceAccount,
// ],
// 'resources' => $resources,
// 'statusCounters' => '{}',
// 'resourceData' => "{}",
// 'errors' => []
// ]));

// $eventsInstance->setParam('migrationId', $migration->getId());

// // Trigger Transfer
// $event = new Migration();
// $event
// ->setMigration($migration)
// ->setProject($project)
// ->setUser($user)
// ->trigger();

// $response
// ->setStatusCode(Response::STATUS_CODE_ACCEPTED)
// ->dynamic($migration, Response::MODEL_MIGRATION);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this code or can it be removed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code was commented out as I was still working on the code that generates a service account and didn't want to start a transfer everytime

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will be uncommented once I'm done with that

Comment thread app/controllers/api/migrations.php Outdated
Comment thread app/controllers/api/migrations.php Outdated
Comment thread app/controllers/api/migrations.php Outdated
Comment thread app/controllers/api/migrations.php Outdated
@PineappleIOnic PineappleIOnic requested a review from abnegate August 4, 2023 10:43
@PineappleIOnic

PineappleIOnic commented Aug 4, 2023

Copy link
Copy Markdown
Contributor Author

Hm, I wonder where all those changes came from. It's rolling back loads. Going to try and fix this now, I'm going create a whole new branch based off 1.4.x and move the migration stuff over to handle this messy conflict

@PineappleIOnic

Copy link
Copy Markdown
Contributor Author

Due to the weird collision issues that occured, I've gone ahead and move to a new branch with a clean slate based off 1.4.x. Please review this PR instead: #5938

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants