SQLite Forum

Feature request for command shell: External editing of schema
Login
The command you may want to edit might not be in the history; it might be in the `sqlite_master` table. For example, you might have a view and trigger defined as:

```sql
CREATE VIEW "abc"(x,y,z) AS SELECT x,y,z FROM "cards" WHERE x < 0;

CREATE TRIGGER "abc_1" INSTEAD OF INSERT ON "abc" BEGIN
  INSERT INTO "abc"(x,y,z) VALUES(new.x,new.y,new.z);
END;
```

Then you will want to edit the definition of that view, to create a temporary file with:

```sql
BEGIN;

DROP VIEW "abc";

CREATE VIEW "abc"(x,y,z) AS SELECT x,y,z FROM "cards" WHERE x < 0;

CREATE TRIGGER "abc_1" INSTEAD OF INSERT ON "abc" BEGIN
  INSERT INTO "abc"(x,y,z) VALUES(new.x,new.y,new.z);
END;

COMMIT;
```

And then once you edit that file and save it and then it is executed, it will recreate the view with the new definition (or the same definition, if you have not changed it).