Ankush Menat
4996b8ac7b
refactor: postgres version check
2023-12-27 16:12:40 +05:30
hhharsha36
445da4319b
fix: error - permission denied for schema public from Postgres >= 15 during initial DB setup ( #23799 )
...
Error from Postgres:
ERROR: permission denied for schema public at character 14
Error from Frappe:
psql:/home/frappe/frappe-bench/apps/frappe/frappe/database/postgres/framework_postgres.sql:72: ERROR: permission denied for schema public
Error Causer:
Starting Postgres version >= 15, all users will have the `CREATE` permission revoked by default.
Fix:
Grant relevant privileges to the database in question for the user. In this case, DB owner privilege.
Note: the below two permission attempts were unsuccessful and still caused the same public schema permission error
GRANT USAGE, CREATE ON SCHEMA public TO {frappe.conf.db_name};
GRANT ALL ON SCHEMA public TO {frappe.conf.db_name}
References:
https://stackoverflow.com/questions/74110708/postgres-15-permission-denied-for-schema-public
https://stackoverflow.com/questions/67276391/why-am-i-getting-a-permission-denied-error-for-schema-public-on-pgadmin-4
2023-12-27 16:04:21 +05:30
Ankush Menat
2dfef73ae8
Merge pull request #22915 from akhilnarang/dont-extract-backup-unconditionally
...
perf: don't extract gzipped backups
2023-12-26 12:19:10 +05:30
Xiaoguang Sun
68d4a5ad82
Do not call begin in updatedb after syncing ( #23934 )
...
Do not call begin in updatedb after syncing as commit does it already.
Signed-off-by: Xiaoguang Sun <sunxiaoguang@gmail.com>
2023-12-26 12:12:19 +05:30
Akhil Narang
6e8f32af58
chore: don't pipe output through pv
...
No point if we're using `execute_in_shell()`
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-12-26 11:09:08 +05:30
Akhil Narang
3fe840fb31
fix(postgres): make use of common helper
...
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-12-26 11:09:08 +05:30
Akhil Narang
76c9fbd0cd
fix: use source before changing its contents
...
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-12-26 11:09:08 +05:30
Akhil Narang
012b0fdb7e
fix(postgres/setup): use gzip to get backup contents if the file is an archive
...
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-12-26 11:09:08 +05:30
Akhil Narang
0b508e2a96
feat(db_manager): avoid extraction of DB dump if gzipped
...
Use `gzip -cd` to directly get the contents onto stdout and pipe to mariadb
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-12-26 11:09:08 +05:30
Hussain Nagaria
ecdd7b3e37
docs: consistency
2023-12-20 14:02:32 +05:30
Hussain Nagaria
8d2137c265
docs: consistent doc strings
2023-12-18 18:27:39 +05:30
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