CREATE VIEW service_meta_columns AS
WITH
tables AS (
SELECT tbl_name AS table_name, sql
FROM sqlite_master
WHERE type = 'table'
AND name NOT LIKE 'sqlite_%'
),
columns AS (
SELECT table_name, cid, name AS col_name,
type, "notnull", dflt_value, pk
FROM tables AS t,
pragma_table_xinfo(
t.table_name)
ORDER BY table_name, cid
)
SELECT * FROM columns;