Commit graph

52 commits

Author SHA1 Message Date
gruener
02d7c7c913
style: fix errormsg to refer postgres instead of mariadb 2025-02-05 14:48:11 +01:00
Akhil Narang
84ef6ec677
refactor: fixup with ruff 0.8.1
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-12-04 13:18:04 +05:30
Akhil Narang
267e58a819
fix: don't prompt users unless we have a TTY
This can break automated runs (which earlier worked)

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-12-02 20:49:11 +05:30
Akhil Narang
d77abb2663
refactor: allow setting mariadb/postgres specific root credentials in site config
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-12-02 13:24:31 +05:30
Akhil Narang
44128aa62e
refactor: update backup restore failure message
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-10-22 12:49:36 +05:30
David
39d4318a27
feat: enable db socket connection 2024-03-29 10:29:50 +01:00
Akhil Narang
06db7a2b2b
fix: can't compare str with int
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-03-13 12:52:54 +05:30
David
61e54eac17
fix: postgres version check 2024-03-12 09:21:34 +01:00
Ankush Menat
de9ac89748 style: re-format with ruff 2024-02-05 18:53:33 +05:30
David Arnold
94378b6566
chore: simplify frappe.connect and use site config for bootstrapping 2024-01-19 13:49:36 +01:00
David Arnold
7bec22e238
Merge remote-tracking branch 'origin/develop' into chore/cleanup-low-level-db-interface 2024-01-18 13:22:33 +01:00
David Arnold
9a1af12a41
chore: more concise code 2024-01-18 10:20:12 +01:00
David Arnold
bd357f41d3
feat: add defaults to db superuser prompt 2024-01-17 20:25:27 +01:00
David Arnold
f889d09d0b
fix: set defaults at the highest level interface 2024-01-17 18:59:34 +01:00
Akhil Narang
9b18289b33
fix: postgres uses double quotes for identifiers, especially if case-sensitive
(single quotes would force it to lowercase)

Also unconditionally create a new user while running tests - we're gonna be dropping the test site

Don't pass a `None` value to bench cli

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-01-16 12:35:01 +05:30
Akhil Narang
265c0b0e01
fix(drop-site): set db root credentials in frappe.flags like how new-site is done
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-01-16 12:35:01 +05:30
Akhil Narang
f876aa385c
fix(setup_db): use the correct user
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-01-16 12:35:01 +05:30
Akhil Narang
1e6eeba9b7
fix: add in missing logic, add in a test for creating a site with a specific user
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-01-16 12:35:01 +05:30
Akhil Narang
c721fcf8c4
refactor: allow setting a db user name different from the database name
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-01-16 12:35:01 +05:30
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
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
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
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
David Arnold
5b33608fe3
fix: shell escaping in execute_in_shell helper 2023-11-16 10:52:11 +01:00
David Arnold
0dc2a9c2f3
refactor: normalize function signature 2023-11-10 15:12:59 +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
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
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
Gavin D'souza
91a47c2602 fix: Deprecate setup help database APIs
APIs have been unused since ~v4/6? Don't see any need to keep them in.
2022-08-12 12:52:19 +05:30
Ankush Menat
5d2aedc698 fix(postgres): end transaction before DDL
closes https://github.com/frappe/frappe/issues/17210
2022-07-05 17:43:02 +05:30
Ankush Menat
81b37cb7d2
refactor: clean up code to py310 supported features (#17367)
refactor: clean up code to py39+ supported syntax

- f-strings instead of format
- latest typing support instead of pre 3.9 TitleCase
- remove UTF-8 declarations.
- many more changes

Powered by https://github.com/asottile/pyupgrade/ + manual cleanups
2022-07-01 11:51:05 +05:30
Ankush Menat
8861752675 fix: restart transaction after commit 2022-06-05 00:26:12 +05:30
chillaranand
1d763a6659 refactor: Fix flake8 issues 2022-05-19 15:34:35 +05:30
Suraj Shetty
c0c5b2ebdd
style: format all python files using black (#16453)
Co-authored-by: Frappe Bot <developers@frappe.io>
2022-04-12 10:59:25 +05:30
Gavin D'souza
2558c6bee0 feat: Drop site support for postgres 2022-03-16 19:06:33 +05:30
Revant Nandgaonkar
cdc6bcadb1
fix(cli): Database agnostic options for root db credentials (#15973)
* fix(bench): new-site params for root db credentials

allow root credentials for postgresql
use common cli option name for both database types

* fix(bench): backward compatible db params

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

* fix(bench): use common db cred params

use --db-root-username and --db-root-password

* feat(bench): add --set-default to bench new-site

* fix: do not set default root user

* fix: indentation

Co-authored-by: gavin <gavin18d@gmail.com>
2022-02-25 09:58:59 +05:30
Gavin D'souza
e407b78506 chore: Drop dead and deprecated code
* Remove six for PY2 compatability since our dependencies are not, PY2
  is legacy.
* Removed usages of utils from future/past libraries since they are
  deprecated. This includes 'from __future__ ...' and 'from past...'
  statements.
* Removed compatibility imports for PY2, switched from six imports to
  standard library imports.
* Removed utils code blocks that handle operations depending on PY2/3
  versions.
* Removed 'from __future__ ...' lines from templates/code generators
* Used PY3 syntaxes in place of PY2 compatible blocks. eg: metaclass
2021-05-26 15:31:29 +05:30
Gavin D'souza
3b5ec6aa88 fix: Sider + improper command ending 2020-11-17 12:45:55 +05:30
Gavin D'souza
c4e57926f9 feat(postgres): Show restore progress if pv is available 2020-11-17 12:33:21 +05:30
Gavin D'souza
142b6009fe fix: Better error message on missing table 2020-11-10 10:49:40 +05:30
Gavin D'souza
e8fdaa195b refactor: PostgreSQL module methods correspond to MariaDB
* Added bootstrap_database, import_db_from_sql function APIs similar
to MariaDB implementations
2020-11-09 18:55:29 +05:30
Suraj Shetty
d546a84659
refactor: Make code more readable 2020-10-18 11:47:28 +05:30
Sebastien Braun
cbf815f25b fix: use configured postgres port in setup_db 2020-10-17 08:08:44 +02:00
Revant Nandgaonkar
1bfa56cd0c feat: backup and restore postgres site 2020-06-27 16:01:30 +05:30
Himanshu Warekar
e955361610 fix: if not db host then localhost 2019-09-11 12:15:04 +05:30
mathieu.brunot
63cda10b9b
🐛 Use db_host to setup pgsql and close #7704
Signed-off-by: mathieu.brunot <mathieu.brunot@monogramm.io>
2019-06-14 18:52:56 +02:00
jibin jose
f1044afe8c Fix postgres tests
- take postgres superuser from user iff it is not in config
2019-05-02 12:29:41 +05:30