Projet

Général

Profil

0006-sql-allow-init_global_table-to-be-called-multiple-ti.patch

Frédéric Péters, 25 mars 2022 14:53

Télécharger (1,14 ko)

Voir les différences:

Subject: [PATCH 6/9] sql: allow init_global_table to be called multiple times
 (#60552)

And recreate wcs_all_forms table anew.

This will be required to keep simple migrations when additional columns
will need to be added to the table.
 wcs/sql.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
wcs/sql.py
1748 1748
        if rows[0][0] == 'v':
1749 1749
            # force wcs_all_forms table creation
1750 1750
            cur.execute('DROP VIEW IF EXISTS wcs_all_forms CASCADE;')
1751
            do_global_views(conn, cur)
1752 1751
        else:
1753 1752
            assert rows[0][0] == 'r'
1754
    else:
1755
        do_global_views(conn, cur)
1753
            cur.execute('DROP TABLE wcs_all_forms CASCADE;')
1754

  
1755
    do_global_views(conn, cur)
1756 1756

  
1757 1757
    # now copy all data into the table
1758 1758
    for formdef in FormDef.select() + CardDef.select():
1759
-