Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate doesn't create table based on dir #33

Closed
mnai01 opened this issue Jan 29, 2024 · 4 comments
Closed

Migrate doesn't create table based on dir #33

mnai01 opened this issue Jan 29, 2024 · 4 comments
Labels
documentation Improvements or additions to documentation

Comments

@mnai01
Copy link

mnai01 commented Jan 29, 2024

Table doesnt appear to be creating on sls offline start, I have also tried serverless dynamodb migrate but no table created. Is this a problem with serverless-dynamodb not supporting the migration object? During testing I do have my amazon/dynamodb-local image running

custom:
    serverless-dynamodb:
        start:
            docker: true
            port: 8000
            inMemory: true
            migrate: true
            seed: true
            convertEmptyValues: true
            noStart: true
        migration:
            dir: offline/migrations
@domdomegg domdomegg added the needs more info Further information is requested label Feb 5, 2024
@domdomegg
Copy link
Member

Could you clarify the behaviour you expect to get with migration.dir?

As far as I can tell, this doesn't seem to be documented or implemented in either serverless-dynamodb or serverless-dynamodb-local, but I might have missed something :)

@domdomegg domdomegg added documentation Improvements or additions to documentation and removed needs more info Further information is requested labels Feb 5, 2024
@domdomegg
Copy link
Member

domdomegg commented Feb 5, 2024

Ah it looks like it might be based on this example, which is using an 8 year old version of serverless-dynamodb-local. The API has changed a lot since then - I'll raise a PR to fix this example so you can see how to achieve the same with the seed key.

In the mean time, you can check out the README for examples on how to seed data: https://github.com/raisenational/serverless-dynamodb?tab=readme-ov-file#seeding-serverless-dynamodb-seed

If this isn't correct, let me know and I can reopen this issue. Thanks for bringing this to my attention :)

@domdomegg domdomegg closed this as not planned Won't fix, can't repro, duplicate, stale Feb 5, 2024
@mnai01
Copy link
Author

mnai01 commented Feb 6, 2024

Ah it looks like it might be based on this example, which is using an 8 year old version of serverless-dynamodb-local. The API has changed a lot since then - I'll raise a PR to fix this example so you can see how to achieve the same with the seed key.

In the mean time, you can check out the README for examples on how to seed data: https://github.com/raisenational/serverless-dynamodb?tab=readme-ov-file#seeding-serverless-dynamodb-seed

If this isn't correct, let me know and I can reopen this issue. Thanks for bringing this to my attention :)

Thank you for getting back to me. Yes, I am referring to the same functionality from the serverless-dynamodb-local example that you linked. The primary goal I am trying to achieve is to perform the database migration locally using just the JSON file, instead of the required resources within the serverless.yml file. This is because I intend to use Serverless only as a local testing tool for my Lambda functions and to use Terraform for deployment.

@domdomegg
Copy link
Member

Ah that makes sense. I think you might be able to implement that by:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants