* Fix "undefined property '__op'" in postgres update
This causes a TypeError which becomes a regular Error,
before the update can be issued. (I think)
This happens when there is an object schema,
and there is also an unrelated field in originalUpdate
which is null or undefined.
e.g. when 'location' is a mandatory object in postgres,
and 'middleName' is an optional string,
PostgresStorageAdapter would throw when a query similar
to the below was performed:
(Object.keys(originalUpdate) would include "middleName" as a value of `k`)
query.set('location', {'country': 'US'})
query.set('middleName', undefined);
* Fix lint error
* Create a test to check the issue #4501
* Check if after the user confirms the email and change the email again a new verification email is sent
* Change the spec text to requested in PR
* Method to upgrade schemas in Postgres;
Adds:
- schemaUpgrade method which check the fields to add and delete from old schema;
* Remove the columns delete in schemaUpgrade method;
* ESLint fix and PostgresStorageAdapter.schemaUpgrade spec test
Adds:
- Add PostgresStorageAdapter.schemaUpgrade spec tests: creates a table,
simulates the addition of a new field and checks if its present in the database
Chores:
- ESLint eol-last fix;
* Add check columns before and after schema upgrade, and remove the unnecessary piece of code
Add:
- Check the right columns is present before schema upgrade and the new field is not,
then check if the right columns is present and the new field;
Remove:
- Piece of code unnecessary because it not need to remove diff columns;
* Optimize the schemaUpgrade method following @vitaly-t instructions, and more tests;
* If the class does not have any columns and needs an upgrade the code would
return without doing so. Fixed this.
Chore:
- Allows class with no column to be upgraded;
- Test for class with no columns being upgraded;
* Update PostgresStorageAdapter.js
rewriting method schemaUpgrade
* Update PostgresStorageAdapter.spec.js
* Update PostgresStorageAdapter.spec.js
* cosmetics
* making nicer promise pattern + if->else blocks
* removing return if unwanted data from an `UPDATE`
* Update PostgresStorageAdapter.js
* Update PostgresStorageAdapter.js
* Update PostgresStorageAdapter.js
Restoring the `UPDATE` result, as apparently it is in fact used. Ouch! 😄
* Update PostgresStorageAdapter.js
* Introduces flow types for storage
* Better typing of QueryOptions
* Adds flow types to SchemaCOntroller,
- runs flow on pre tests
- fixes flow
* Adds ClassLevelPermissions type
* Moves Controller types into a single file
* Changes import styles
* Changes import styles
* fixing method setIndexesWithSchemaFormat (#4454)
Fixing invalid database code in method `setIndexesWithSchemaFormat`:
* It must be a transaction, not a task, as it executes multiple database changes
* It should contain the initial queries inside the transaction, providing the context, not outside it;
* Replaced the code with the ES6 Generator notation
* Removing the use of batch, as the value of the result promise is irrelevant, only success/failure that matters
* nits
* Fixes tests, improves flow typing
* fix(package): update mongodb to version 3.0.0
* Compatibility with MongoDB client 3.0
* Updates Gridstore as well
* Set Read preference to Primary when not specified, to match original implementation
* Update MongoStorageAdapter.js
* Bumps to 3.0.1
* refactoring method createClass
Removing error-analysis conditions that are irrelevant, i.e. since we are only returning the batch, the error will always have `data` set to the size of the input array, as per [the library's API](http://vitaly-t.github.io/spex/errors.BatchError.html).
* Update PostgresStorageAdapter.js
removing the use of the default separator.
* Refactoring method `addFieldIfNotExists`
* Using ES6 Generators syntax
* Passing in the context into method `createClass`, to reuse the connection
* Extending method `createClass` to reuse connections
* Update PostgresStorageAdapter.js
forgot: extending method `createClass` to reuse the connection.
* Update PostgresStorageAdapter.js
fixing the re-throw logic.
Method `setClassLevelPermissions` should use `.task` to share the connection for the two consecutive operations. It doesn't need a transaction, because the first operation does not need to roll back when the second one fails.
* Refactoring method createTable
Replacing the weird task + transaction chain, by replacing it with just one transaction that encapsulates the complete logic.
* Update PostgresStorageAdapter.js
correcting the sequence to match the original exactly.
* Update PostgresStorageAdapter.js
Nesting the transaction inside a task, so it can execute successfully no matter if the containing task succeeds or fails.
* Update PostgresStorageAdapter.js
adding the missing bracket.
Fixing invalid database code in method `setIndexesWithSchemaFormat`:
* It must be a transaction, not a task, as it executes multiple database changes
* It should contain the initial queries inside the transaction, providing the context, not outside it;
* Replaced the code with the ES6 Generator notation
* Removing the use of batch, as the value of the result promise is irrelevant, only success/failure that matters
* refactoring database code
Starting to refactor the database code for better use of promises + ES6 generators, to prepare for ES7 await/async.
* Update PostgresStorageAdapter.js
* Update PostgresStorageAdapter.js
naming the transaction.