laravel-watermelon icon indicating copy to clipboard operation
laravel-watermelon copied to clipboard

Migrations support

Open rafwell opened this issue 1 year ago • 3 comments

Hi!

This package support migrations implementation? I did a test here but the new columns who I've added aren't pulled then sync.

rafwell avatar Dec 01 '23 14:12 rafwell

Did you update your model's $watermelonAttributes?

class Task extends Model
{
    use SoftDeletes, Watermelon;

    protected array $watermelonAttributes = [
        'content',
        'is_completed',
    ];
}

nathanheffley avatar Dec 03 '23 13:12 nathanheffley

Hi!

Yes. I think it really was missing in this package. Take a look on my implementation: https://github.com/rafwell/laravel-watermelon/commit/01dd6bf38be0ada2524e116cdd0912434f4e2f0f

I'm basing on this https://watermelondb.dev/docs/Sync/Backend#implementing-pull-endpoint who said 6. If migration is not null, you MUST include records needed to get a consistent view after a local database migration Now i'm getting the new columns when columns has change by migration. I think the same must be did for new tables, if you like I can do it via PR.

rafwell avatar Jan 29 '24 19:01 rafwell

Ohhh yes I see. Yes if you opened a PR that would be fantastic. Would you also be able to add a feature test where it demonstrates pulling records when there is a column that has been migrated?

nathanheffley avatar Feb 05 '24 02:02 nathanheffley