Re: [PATCH] migrate the database schema to SQLAlchemy

2020-02-23 Thread Lukas Fleischer
On Sat, 22 Feb 2020 at 23:28:25, Frédéric Mangano-Tarumi wrote:
> Lukas Fleischer [2020-02-22 22:43:31 +0100]
> > > +5) Create a new MySQL database and a user and import the aurweb SQL 
> > > schema:
> > > +
> > > +$ python -m aurweb.initdb
> > > +
> > 
> > I noticed that this step is slightly confusing: the command must be
> > executed from the aurweb/ subdirectory, not the top-level directory of
> > the project.
> 
> Could you please try running `python -m aurweb.initdb --help` from the
> top-level directory, then in the aurweb subdirectory? In a vanilla
> setup, only the former works for me.

You are right. I guess I was confused by nested subdirectories with the
same name. Sorry for the noise.


Re: [PATCH] migrate the database schema to SQLAlchemy

2020-02-22 Thread Frédéric Mangano-Tarumi
Lukas Fleischer [2020-02-22 22:43:31 +0100]
> > +5) Create a new MySQL database and a user and import the aurweb SQL schema:
> > +
> > +$ python -m aurweb.initdb
> > +
> 
> I noticed that this step is slightly confusing: the command must be
> executed from the aurweb/ subdirectory, not the top-level directory of
> the project.

Could you please try running `python -m aurweb.initdb --help` from the
top-level directory, then in the aurweb subdirectory? In a vanilla
setup, only the former works for me.

By the way, I think we should add a step for installing the aurweb
Python package between 2) and 4) in TESTING. Running `pip install -e .`
installs aurweb in develop mode which ensures aurweb is importable
everywhere without forcing developers to reinstall the package everytime
the code changes.


Re: [PATCH] migrate the database schema to SQLAlchemy

2020-02-22 Thread Lukas Fleischer
On Sun, 16 Feb 2020 at 21:56:10, Frédéric Mangano-Tarumi wrote:
> The new schema was generated with sqlacodegen and then manually adjusted
> to fit schema/aur-schema.sql faithfully, both in the organisation of the
> code and in the SQL generated by SQLAlchemy.
> 
> Initializing the database now requires the new tool aurweb.initdb.
> References to aur-schema.sql have been updated and the old schema
> dropped.
> ---
>  INSTALL|  12 +-
>  TESTING|  23 +--
>  aurweb/db.py   |  27 +++
>  aurweb/initdb.py   |  47 +
>  aurweb/schema.py   | 387 ++
>  schema/Makefile|  12 --
>  schema/aur-schema.sql  | 415 -
>  schema/reloadtestdb.sh |  29 ---
>  test/Makefile  |   6 +-
>  test/setup.sh  |   5 +-
>  10 files changed, 481 insertions(+), 482 deletions(-)
>  create mode 100644 aurweb/initdb.py
>  create mode 100644 aurweb/schema.py
>  delete mode 100644 schema/Makefile
>  delete mode 100644 schema/aur-schema.sql
>  delete mode 100755 schema/reloadtestdb.sh
> 
> diff --git a/INSTALL b/INSTALL
> index 7170aea1..68fe5dcd 100644
> --- a/INSTALL
> +++ b/INSTALL
> @@ -45,16 +45,16 @@ read the instructions below.
> [...]
> +5) Create a new MySQL database and a user and import the aurweb SQL schema:
> +
> +$ python -m aurweb.initdb
> +

I noticed that this step is slightly confusing: the command must be
executed from the aurweb/ subdirectory, not the top-level directory of
the project. I will probably add an additional line

$ cd /srv/http/aurweb/aurweb/

before the command.