sails-dynamodb
sails-dynamodb copied to clipboard
Automatically create tables
When adding new models that connect to dynamo db, the adapter does not automatically create the table if it does not already exist. Is this by design? Should we make a specific call to create the table? We do not want to have to create the table manually each time. We also realize it does not lazy load the table either (we tried creating a new object but this also failed to create the table). If we create the table manually, everything else seems to work as expected. No errors are thrown.
We are also getting the following error when calling SomeModel.create():
/usr/local/lib/node_modules/sails/node_modules/waterline/lib/waterline/error/WLError.js:30
this.rawStack = (this._e.stack.replace(/^Error(\r|\n)*(\r|\n)*/, ''));
TypeError: Cannot read property 'replace' of undefined
at new WLError (/usr/local/lib/node_modules/sails/node_modules/waterline/lib/waterline/error/WLError.js:30:33)
This adapter currently does not create tables. It would take a little bit of effort to support this, but it's totally in the realm of possibility! I'm making this issue a feature request.
+1 for this feature
+1
has anyone added this functionality?
Nope! Still on the table.
Can guide me?
Can I use this one : https://github.com/TakenPilot/sails-dynamodb ??
That library does appear to create tables here, though I'd estimate this library is otherwise more mature. Maybe we can learn from their approach.
+1
+1
I'm happy to work on this. If someone can answer my issue #37 about using a local instance.
@liftyourgame , I commented on #37 about using dynamodb local. For others, see this link: https://aws.amazon.com/blogs/aws/dynamodb-local-for-desktop-development, I actually found it to not be troublesome to just make the database tables myself. There are some quirks with dynamo around indexes and I think making these choices explicit when setting up the table is right. That said, if implemented well, this could be a great feature. It takes a while to add an index to an existing table and that could be annoying.