barredterra
c35476256f
refactor: simplify conditional logic
...
Command: `sourcery review --fix --enable de-morgan .`
2023-12-05 11:14:41 +01:00
Akhil Narang
fbc88a4d24
refactor(treewide): code cleanup
...
Drop redundant bool conversion
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-11-23 13:57:51 +05:30
Ankush Menat
d715b0ad31
Merge pull request #22804 from akhilnarang/non-nullable-fields
...
feat: allow setting fields as not nullable
2023-11-20 12:46:02 +05:30
Akhil Narang
ae9ae40bad
Merge pull request #23168 from blaggacao/refactor/centralize-python-shell-interface-for-database-binaries
...
refactor: give cli invocations of dbtools a dedicated interface
2023-11-17 17:02:41 +05:30
David Arnold
283e91fd43
fix: minor fixes
...
Co-authored-by: Akhil Narang <me@akhilnarang.dev>
2023-11-17 10:01:53 +01:00
Akhil Narang
5c023d238d
fix: get correct column definition
...
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-11-16 16:14:50 +05:30
Akhil Narang
e1bbcd73ab
fix: 0 is falsy, set correct defaults
...
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-11-16 16:14:50 +05:30
Akhil Narang
e3f6437245
fix(postgres): properly change nullability and default values
...
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-11-16 16:14:50 +05:30
David Arnold
5b33608fe3
fix: shell escaping in execute_in_shell helper
2023-11-16 10:52:11 +01:00
Akhil Narang
75c8445b6a
refactor: cleanup column definition
...
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-11-16 14:51:57 +05:30
Akhil Narang
5598fe241e
fix: use default default if a custom default isn't specified
...
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-11-16 14:51:57 +05:30
Akhil Narang
b901f37267
feat(postgres/schema): add support for setting fields as not-nullable
...
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-11-16 14:51:57 +05:30
Akhil Narang
558ac413ce
fix(mariadb/schema): use correct default value
...
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-11-16 14:51:57 +05:30
Akhil Narang
8d540963c8
refactor(mariadb/schema): use sql_ddl() method
...
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-11-16 14:51:57 +05:30
Akhil Narang
ccc2bdad52
fix: go back to original transaction handling mechanism
...
This reverts the following:
07acfeed47 chore: move check_implicit_commit() call back to its original location
fc38a0b503 chore: simplify transaction handling
1e29e81543 chore: rework implicit commit checks
ae0a3fd202 feat: allow ignoring implicit commit warning
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-11-16 14:51:57 +05:30
Akhil Narang
4855ec76c2
chore: use index to access table column instead of getattr
...
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-11-16 14:51:57 +05:30
Akhil Narang
12a0afd91f
refactor: cleanup DbColumn.get_definition()
...
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-11-16 14:51:57 +05:30
Akhil Narang
5e6be19fe3
chore(DbColumn): force constructor arguments to be kwargs
...
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-11-16 14:51:57 +05:30
Akhil Narang
6b49b5f32a
chore: move check_implicit_commit() call back to its original location
...
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-11-16 14:51:57 +05:30
Akhil Narang
806748b063
chore: simplify transaction handling
...
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-11-16 14:51:57 +05:30
Akhil Narang
fe549ecc49
chore: don't check for semgrep here
...
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-11-16 14:51:57 +05:30
Akhil Narang
f9b9184223
chore: rework implicit commit checks
...
Add in some more "reset" queries
- begin
- start
Also check *after* resetting
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-11-16 14:51:57 +05:30
Akhil Narang
58b8b26b93
chore(mariadb): switch to using query builder for update statement
...
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-11-16 14:51:57 +05:30
Akhil Narang
e41fa2dfc7
feat: migrate columns to be non-nullable if required
...
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-11-16 14:51:57 +05:30
Akhil Narang
6550e0769b
feat: allow ignoring implicit commit warning
...
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-11-16 14:51:57 +05:30
Akhil Narang
4f9ee8b633
feat(DbColumn): set non_nullable attribute and make use of it for column definition
...
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-11-16 14:51:57 +05:30
David Arnold
0dc2a9c2f3
refactor: normalize function signature
2023-11-10 15:12:59 +01:00
David Arnold
e88fa11cdc
fix(db): add missing bootstrap public interface
2023-11-09 17:11:40 +01:00
David Arnold
b2f9ff09aa
feat(db): boostrap only option if resource management is exogenous
...
The database resource management including privileges granting can be
done by external secops. It can be undesirable to grant the grant option
to the framework user.
This commit implements the possibility to remove user resource
management from frappe entirely and only boostrap the database with its
target user.
2023-11-09 17:11:39 +01:00
David Arnold
40a2daf84c
chore: give cli invocations of dbtools a dedicated interface
2023-11-09 12:14:41 +01:00
David Arnold
d5a390cd95
chore: compose postgres conn settings in the same way as with mariadb
2023-11-09 10:00:24 +01:00
gavin
00e222f303
fix(cli): Use mysql CLI as fallback is mariadb isnt found ( #23009 )
...
[skip_ci]
2023-10-30 16:16:22 +00:00
Akhil Narang
091ebdd8dc
refactor(treewide): use mariadb commands directly instead of mysql ( #22620 )
...
This has been done because the mysql command issues a deprecation warning now
mysql: Deprecated program name. It will be removed in a future release, use '/usr/bin/mariadb' instead
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-10-10 12:49:16 +05:30
Ankush Menat
0d5f28d569
feat: rename custom field
2023-09-25 12:25:28 +05:30
Ankush Menat
acd1b9d64e
fix: Don't run query if dn is None ( #22475 )
2023-09-19 15:11:15 +00:00
Sagar Vora
7e9b08a040
fix: convert value column to longtext for Singles
2023-09-06 16:23:01 +05:30
Ankush Menat
961585f1d9
fix: misc dx improvemnts ( #22188 )
...
* fix(dx): simplify adding callbacks
frappe.db.after_commit(func) == frappe.db.after_commit.add(func)
* fix: trace id missing
DB gets initted before request
2023-08-28 07:01:25 +00:00
Ankush Menat
730e906dfd
refactor!: remove implicit primary key from logs ( #22209 )
2023-08-26 16:01:47 +05:30
Ankush Menat
59e49d89fe
feat: include Trace ID in all SQL queries
2023-08-23 13:59:24 +05:30
Ankush Menat
79392260d4
fix: autoincr caching and clear site cache after restore ( #22079 )
...
* fix: remove hazardous cache for autoincr
* fix: move cache to redis
* fix: clear all redis cache after restoring a site
2023-08-17 11:11:27 +05:30
mergify[bot]
fd10ab25cc
Merge pull request #22003 from gavindsouza/refactor-doc-bits
...
refactor: Use single query to delete child rows on doc.save
2023-08-11 06:45:07 +00:00
Gavin D'souza
28e657b603
fix: Check if fieldtype in set rather than str comparison
2023-08-11 11:45:42 +05:30
barredterra
88c8baa9ee
refactor: for append to extend, merge list extend
...
Replace a for append loop with list extend.
Create the list with values instead of creating
an empty list and extending it with another list.
2023-08-09 13:25:39 +02:00
barredterra
b553ed98d8
refactor: inline immediately returned variable
...
Inline a variable to a return in the case when the
variable being declared is immediately returned
2023-08-08 18:09:49 +02:00
Ankush Menat
22a3a56d44
chore: remove conflict-marker look-alike
...
This is annoying when trying to find git conflicts
[skip ci]
2023-07-28 11:45:56 +05:30
David Arnold
a926e64ec9
fix: procure db config from single authority ( #21578 )
...
* fix: procure db config from single authority
ensures that configuration is uniformely procured from local.conf
instead of making use of hard to audit multilevel fallback logic
Implementation Note:
- `get_db(host, port, user, password)` was stripped of any optional
argument and therefrom all errors where fixed.
- All occurances of `grep 'frappe.db.db_'` where changed to
`frappe.conf.db_`
* fix: revert unnecessary breaking changes
2023-07-24 10:48:29 +05:30
Ankush Menat
adf30693a9
ci: update pyupgrade
2023-07-14 14:24:08 +05:30
David Arnold
6b2bb9a2ab
fix: add env overrides for service orchestration ( #21577 )
...
This avoids having to manipulate config files in brittle bash
entrypoints that need to react to dynamic service discovery.
This significantly improves the operability of various bench sites.
2023-07-14 11:39:01 +05:30
Ankush Menat
8a37d6d278
perf: reduce memory usage of background processes ( #21467 )
...
* perf: defer translation.py imports
This indirectly imports babel which isn't really required most of the
time.
* perf: defer gzip import
* perf: move validate_and_sanitize_search_inputs
This causes all sorts of indirect imports and increases memory usage
* perf: defer requests module imports
* perf: defer system settings import
* perf: defer LOG_DOCTYPES import
Causes many indirect imports
* perf: defer update_site_config
* perf: defer notifications import
* perf: remove unused import
* perf: defer safe exec import
* test: memory usage overhead
2023-06-23 12:51:45 +05:30
Ankush Menat
3f3ee12338
Revert: keep supporting set_value for singles
...
w/ explicit check for singles
This shouldn't have any performance impact as last function call only
happens if we THINK it's single doctype. use set_single_value to avoid
that extra function call.
2023-06-14 17:30:32 +05:30