Commit graph

339 commits

Author SHA1 Message Date
Saqib Ansari
9e6889fc6d Merge branch 'develop' of https://github.com/frappe/frappe into link_title_refactor 2022-02-15 10:12:52 +05:30
Ankush Menat
c38d1f8a25
Merge pull request #15906 from ankush/ignore_duplicates_db
feat(db/pg): ability to ignore pk collision
2022-02-14 18:58:07 +05:30
Suraj Shetty
abec0d8664
Merge branch 'develop' into link_title_refactor 2022-02-14 11:03:55 +05:30
Ankush Menat
1439e667b2 chore: add debug status temporarily 2022-02-09 16:25:39 +05:30
Saqib Ansari
6e0c4946f1 Merge branch 'develop' of https://github.com/frappe/frappe into link_title_refactor 2022-02-09 10:43:34 +05:30
Gavin D'souza
0482f1362a Merge branch 'develop' of github.com:frappe/frappe into dynamic-docfields 2022-02-08 16:50:58 +05:30
phot0n
a6ea0c9e37 fix: add index on parent in child table doctype 2022-02-07 17:49:37 +05:30
phot0n
266e1f95ed chore: adding back idx column
This is needed for ordering in display of links as it keeps
track of the clicks on a particular link item
2022-02-07 16:40:01 +05:30
phot0n
b31f3c24f6 refactor: remove parent, parenttype, parentfield, idx columns from non-child table doctypes
* feat: add parent, parenttype, idx, parentfield columns to doctypes when transitioning from normal -> child table

* fix: remove parent, parenttype, parentfield, idx from DocType DocType
2022-02-07 15:12:37 +05:30
Suraj Shetty
68d934ae0f
Merge branch 'develop' into link_title_refactor 2022-02-04 14:53:26 +05:30
mergify[bot]
819202f5da
Merge pull request #15560 from gavindsouza/set_value-refactor
refactor: frappe.db.set_value
2022-02-02 06:41:58 +00:00
Gavin D'souza
bd89a9de86 Merge branch 'develop' of github.com:frappe/frappe into dynamic-docfields 2022-02-01 18:14:58 +05:30
Gavin D'souza
66b09afda6 fix: Don't create DB column for Virtual DocFields 2022-02-01 17:48:02 +05:30
Saqib Ansari
bd8ac90286
fix(ux): show report button on too many writes error (#15614)
* feat: log errors on too many writes to ease debugging

* fix(ux): extract and show which app/file/function caused too many writes

* fix: postgres error checking assumes exception is postgres exception

* fix: better default for skipping frames

Typically stack is like: some_app -> your_function -> this function. So last 2 frames need to be skipped.

* fix: postgres error checking assumes exception is postgres exception

* fix: better default for skipping frames

Typically stack is like: some_app -> your_function -> this function. So last 2 frames need to be skipped.

* refactor: show Report button instead of logging

* revert: unnecessary new functionality

* test: assert exact exception

Co-authored-by: Ankush Menat <ankush@frappe.io>
2022-01-31 18:57:32 +05:30
Gavin D'souza
5b6ceb5543 Merge branch 'develop' of github.com:frappe/frappe into set_value-refactor 2022-01-28 18:39:12 +05:30
Ankush Menat
e5eca8232f
fix: dont auto drop manually created index on text types (#15739) 2022-01-26 17:47:30 +05:30
Suraj Shetty
75245c25dc
Merge pull request #15680 from surajshetty3416/fix-db-index 2022-01-25 11:16:47 +05:30
Ankush Menat
e58c557e12 fix: correctly compute doctype name from table name 2022-01-24 11:18:21 +05:30
Suraj Shetty
490b2f61cd chore: Add nosemgrep comment to avoid semgrep warnings 2022-01-24 11:00:18 +05:30
Suraj Shetty
9a5409892d fix(postgres): Create indexes while creating table
Previously, indexes were not getting created based on "search_index" configuration while creating new table
2022-01-24 10:26:38 +05:30
Suraj Shetty
47393bcb85 style: Fix formatting issues 2022-01-24 09:44:25 +05:30
Suraj Shetty
4d384f308b fix: Unique and Index constraints 2022-01-23 22:57:33 +05:30
Suraj Shetty
39031d18ed fix: Check if index exists with specific key_name 2022-01-23 17:44:07 +05:30
Suraj Shetty
c0fe37b94e fix: Sync "index" & "Unique" constraint changes in DB 2022-01-21 21:18:16 +05:30
Gavin D'souza
227dc26707 Merge branch 'develop' of github.com:frappe/frappe into set_value-refactor 2022-01-17 14:04:13 +05:30
Saqib Ansari
30ba577c0a Merge branch 'develop' of https://github.com/frappe/frappe into link_title_refactor 2022-01-14 15:20:56 +05:30
Gavin D'souza
b64dc65088 fix: Set cache=True to maintain old behaviour consistency 2022-01-11 16:25:10 +05:30
Gavin D'souza
d81fe8699c feat: frappe.db.set_single_value
Alias to frappe.db.set_value without having to pass the doctype name
twice or teh second one as None

Other changes:
* set/get db APIs for single DocTypes
* Make use of redundant cache key in frappe.db.get_single_value
2022-01-10 21:03:14 +05:30
Gavin D'souza
479f637f76 fix(single:set_value): Cast using sbool instead of str for all 2022-01-10 20:59:50 +05:30
Gavin D'souza
3052808048 fix: Don't cast to str if None or Falsy
* refactor: use get_single_value instead of set_value(blah, None, blah1)
* User.reload in test_home_page to combat what happens locally
2022-01-10 15:05:57 +05:30
Saqib Ansari
06b00e8e01 Merge branch 'develop' of https://github.com/frappe/frappe into link_title_refactor 2022-01-07 16:01:44 +05:30
Gavin D'souza
123bcc9509 fix: Clear cache on set_value 2022-01-07 14:16:45 +05:30
Gavin D'souza
b0c30363cf fix: Cast values as str for all single doctypes
Re-arranged block for simplicity. Type casting doesn't change anything
it seems. On get_value, values are casted properly.
2022-01-07 11:49:49 +05:30
Gavin D'souza
697d6f2d7a fix: Run query even if no documents found for_update
If no docnames are found, then use NULL as fallback. I tested this on PostgreSQL & MariaDB and it seems to work as expected

    In [1]: from frappe.query_builder import Field

    In [2]: frappe.db.set_value('ToDo', Field("creation") > Field("modified"), 'description', 'change 2', for_update=True, debug=True)
    SELECT "name" FROM "tabToDo" WHERE "creation">"modified"
    Execution time: 0.0 sec
    UPDATE "tabToDo" SET "description"='change 2',"modified"='2021-10-22 09:38:40.110481',"modified_by"='Administrator' WHERE "name" IN (NULL)
    Execution time: 0.0 sec
2022-01-07 11:47:49 +05:30
Gavin D'souza
aefb8e3b06 fix: Expand iterable to get rid of extra brackets
Although valid SQL, MariaDB didn't like double brackets on VALUES. It
raised ERROR 1241: Operand should contain 1 column(s)
2022-01-07 11:46:56 +05:30
Gavin D'souza
44f603fc6e refactor: frappe.db.set_value
* Simplified logic
* Perf enhancements (removed unnecessary conditional computations)
* Use query builder and ORM to build queries instead of juggling
2022-01-07 11:45:27 +05:30
Gavin D'souza
981564e544 Merge branch 'develop' into frappe-postgres-changes 2022-01-07 11:37:28 +05:30
Conor
40ba1ac9ba fix: Postgres Compatibility
* Handle inconsistencies in type handling in DatabaseQuery & Database
  APIs
* Update incompatible queries with frappe.qb notation
* Fixed use cases discovered by failing ERPNext CI tests

fix: db independent syntax for user_type

fix: handle postgres datetime values

feat: add ability to auto commit on db inserts

feat: add ability to escape underscore in postgres

fix: handle missing data in test runner bootstrapping

fix: db independent syntax for queries

fix: refactor to use qb

fix: update cache for language

fix: use pluck in email_queue

Co-authored-by: gavin <gavin18d@gmail.com>

fix: don't auto insert on tests for make_property_setter

fix: remove auto_commit in custom_field insertion

fix: remove auto_commit functionality

fix: review comments

fix: revert link validation

fix: style suggestion for readability

Co-authored-by: gavin <gavin18d@gmail.com>

fix: revert .lower() in link validation

fix: add rollback for setup_wizard

Revert "fix: add rollback for setup_wizard"

This reverts commit 83b3b0913db17718ccd5edae01858cff15603829.

Revert "feat: add ability to escape underscore in postgres"

This reverts commit 8ed9c2aa3306438e94bb813f60e65b416d0b947b.

fix: more concise representation of order fields

Co-authored-by: gavin <gavin18d@gmail.com>
2022-01-07 10:44:57 +05:30
mergify[bot]
ea5d99b0e9
Merge pull request #15484 from MochaTechnologies/migrate-new-column-index
fix(Migrate): add unique and index for new columns
2022-01-06 05:54:18 +00:00
mergify[bot]
96a45473ab
Merge pull request #15492 from resilient-tech/fix-clear-cache-in-set-value
fix: clear cache for all docs matched with the filters passed as `dn` param in `set_value`
2022-01-05 07:06:07 +00:00
Ankush Menat
80d456ef7e fix: avoid cached results for table_exists during install 2022-01-05 11:54:46 +05:30
Ankush Menat
08464553f3 fix: define check_transaction_status for postgres
To implement repeatable reads it has to respect transactions.
2022-01-04 13:59:22 +05:30
Ankush Menat
43364cf89b fix!: use repeatable read isolation level
RR isolation is default in MariaDB, for sake of consistency use same
isolation level in postgres
2022-01-04 13:59:22 +05:30
Ankush Menat
0fddbafd09 fix(postgres)!: dont silently rollback on db exception 2022-01-04 11:25:08 +05:30
Ankush Menat
d603aaf601 fix: define is_syntax_error for postgres 2022-01-04 11:25:08 +05:30
Ankush Menat
3c83043301 chore: sort imports
also fix `time` import
2022-01-04 10:53:31 +05:30
Ankush Menat
e08b41964c feat: savepoint contextmanager
syntactic sugar around frappe.db.savepoint and rollback
2022-01-03 22:20:39 +05:30
Rushabh Mehta
66a8e125d4 fix(ux): add "Show Dashboard" check for tab breaks 2022-01-03 13:57:36 +05:30
Pruthvi Patel
289d7e7afa fix: clear cache when filters passed as dn param in set_value 2022-01-01 17:49:59 +05:30
Saif Ur Rehman
063cc293a9 fix(Migrate): add unique and index for new columns 2021-12-31 13:37:40 +05:00