0
0
mirror of https://github.com/tursodatabase/libsql.git synced 2024-12-12 15:33:44 +00:00
libsql/libsql-wal/tests/assets/fixtures/alterdropcol.test
ad hoc ad79ef48a2
libsql wal tests (#1408)
* add tests

* add bench
2024-05-24 13:59:17 +00:00

84 lines
1.6 KiB
Plaintext

CREATE TABLE t1(a, b, c);
CREATE VIEW v1 AS SELECT * FROM t1;
CREATE TABLE t2(x INTEGER PRIMARY KEY, y, z UNIQUE);
CREATE INDEX t2y ON t2(y);
CREATE TABLE t3(q, r, s);
CREATE INDEX t3rs ON t3(r+s);
CREATE VIRTUAL TABLE ft1 USING fts5(one, two);
ALTER TABLE t1 DROP COLUMN b;
SELECT sql FROM sqlite_schema WHERE name = 't1'
ALTER TABLE t1 DROP COLUMN c;
SELECT sql FROM sqlite_schema WHERE name = 't1'
CREATE TABLE t12(a, b, c, CHECK(c>10));
CREATE TABLE t13(a, b, c CHECK(c>10));
CREATE TABLE p1(a PRIMARY KEY, b UNIQUE);
CREATE TABLE c1(x, y, z REFERENCES p1(c));
CREATE TABLE c2(x, y, z, w REFERENCES p1(b));
ALTER TABLE c1 DROP COLUMN z;
ALTER TABLE c2 DROP COLUMN z;
SELECT sql FROM sqlite_schema WHERE name IN ('c1', 'c2');
CREATE VIEW v1 AS SELECT d, e FROM p1
DROP VIEW v1;
CREATE VIEW v1 AS SELECT x, y FROM c1;
CREATE TRIGGER tr AFTER INSERT ON c1 BEGIN
INSERT INTO p1 VALUES(new.y, new.xyz);
END;
DROP TRIGGER tr;
CREATE TRIGGER tr AFTER INSERT ON c1 BEGIN
INSERT INTO p1 VALUES(new.y, new.z);
END;
CREATE TABLE t1(a, b, c, PRIMARY KEY(a COLLATE nocase, a)) WITHOUT ROWID;
INSERT INTO t1 VALUES(1, 2, 3);
INSERT INTO t1 VALUES(4, 5, 6);
ALTER TABLE t1 DROP COLUMN c;
SELECT sql FROM sqlite_schema;
SELECT * FROM t1;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
PRAGMA writable_schema = 1;
UPDATE sqlite_schema
SET sql = 'CREATE TABLE t1(a INTEGER PRIMARY KEY AUTOINCREMENT, b)'
ALTER TABLE t1 DROP COLUMN b;
SELECT sql FROM sqlite_schema;