gadelkareem / sails-dynamodb

Amazon DynamoDB adapter for Waterline / Sails.js
http://sailsjs.org
46 stars 22 forks source link

Automatically create tables #14

Open jkeczan opened 9 years ago

jkeczan commented 9 years ago

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.

jkeczan commented 9 years ago

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)
devinivy commented 8 years ago

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.

mlconnor commented 8 years ago

+1 for this feature

bohdanrutylo commented 8 years ago

+1

muditjuneja commented 8 years ago

has anyone added this functionality?

devinivy commented 8 years ago

Nope! Still on the table.

muditjuneja commented 8 years ago

Can guide me?

muditjuneja commented 8 years ago

Can I use this one : https://github.com/TakenPilot/sails-dynamodb ??

devinivy commented 8 years ago

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.

carlospliego commented 7 years ago

+1

redhat-raptor commented 7 years ago

+1

liftyourgame commented 7 years ago

I'm happy to work on this. If someone can answer my issue #37 about using a local instance.

ferrants commented 7 years ago

@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.