Skip to content

[Suggestion] Don't rebuild table if field added #1677

Closed

Description

@chrisjlocke

Details for the issue

Testing on another issue confirmed the process when a table is modified. The existing table is modified, a new table is created, data is copied across, the old table deleted and finally the new table renamed. However, if a field is simply added to the end of the table, this process is unnecessary, and if the table is large, wastes a lot of time. If DB4S knew that in the 'Edit Table' dialog that 'remove field', 'move up' and 'move down' buttons weren't pressed (so the schema was only minorly modified) it could skip the superfluous fluff.

What did you do?

add a field

What did you expect to see?

the table edited

What did you see instead?

extraness which maybe didn't have to happen

Useful extra information

Heres a full log.

PRAGMA database_list;
SELECT type,name,sql,tbl_name FROM "main".sqlite_master;
PRAGMA "main".TABLE_INFO("view_contactsData2");
PRAGMA "main".TABLE_INFO("view_contactsData");
PRAGMA "main".TABLE_INFO("view1");
PRAGMA "main".TABLE_INFO("v_meetings");
CREATE TABLE "sqlb_temp_table_1" (
	"au_id"	INTEGER,
	"au_section"	TEXT,
	"au_sectionReference"	INTEGER,
	"au_userId"	INTEGER,
	"au_date"	TEXT,
	"au_details"	TEXT,
	"au_notes"	TEXT,
	"Field8"	INTEGER,
	PRIMARY KEY("au_id")
);
INSERT INTO "main"."sqlb_temp_table_1" ("au_date","au_details","au_id","au_notes","au_section","au_sectionReference","au_userId") SELECT "au_date","au_details","au_id","au_notes","au_section","au_sectionReference","au_userId" FROM "main"."audit";
PRAGMA defer_foreign_keys
PRAGMA defer_foreign_keys = '1';
DROP TABLE "main"."audit";
ALTER TABLE "main"."sqlb_temp_table_1" RENAME TO "audit"
PRAGMA defer_foreign_keys = '0';
PRAGMA database_list;
[etc]

The info below often helps, please fill it out if you're able to. :)

What operating system are you using?

Who cares?

What is your DB4S version?

Nightly.

Did you also

No.

Activity

  1. justinclift commented on Dec 23, 2018

    @justinclift
    Member

    Sounds like a decent idea to me. 😄

  2. MKleusberg commented on Dec 25, 2018

    @MKleusberg
    Member

    Hmm, as in #1686 this works fine for me. If we're using the same SQLite version, this might be a more general issue in our code then.

  3. MKleusberg commented on Feb 15, 2019

    @MKleusberg
    Member

    This might be a part of the issue in #1725. So it's worth trying this one again too with tomorrow's nightly build 😄

  4. chrisjlocke commented on Feb 15, 2019

    @chrisjlocke
    MemberAuthor

    It is indeed. Can confirm only 1 ALTER TABLE statement is now performed.
    Thanks! 🌹

  5. MKleusberg commented on Feb 15, 2019

    @MKleusberg
    Member

    Awesome 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions