ppx_rapper icon indicating copy to clipboard operation
ppx_rapper copied to clipboard

schema creation and semicolon

Open phstrauss opened this issue 2 years ago • 0 comments

Hello, How do I create a schema using ppx_rapper with the semicolon restriction, here's my schema creation code, which happen to not work. I'm using the sqlite3 backend on ubuntu 20.04 and OCaml 4.13.1:

Thanks!

let init_db =
    [%rapper execute {sql|
        DROP TABLE IF EXISTS client

        CREATE TABLE IF NOT EXISTS client(
                    host TEXT NON NULL,
                    useragent TEXT
                )

        DROP TABLE IF EXISTS request

        CREATE TABLE IF NOT EXISTS request(
                    since_begin REAL,
                    request TEXT NON NULL,
                    retcode INTEGER,
                    size INTEGER,
                    referrer TEXT
                )

        CREATE INDEX i0 ON request(request)

        CREATE INDEX i1 ON request(referrer)

        DROP TABLE IF EXISTS visit

        CREATE TABLE IF NOT EXISTS visit(
                    begin REAL,
                    id_client INTEGER,
                    spam BOOLEAN,
                    resources INTEGER,
                    pages INTEGER
                )

        CREATE INDEX i2 ON visit(id_client)

        DROP TABLE IF EXISTS req_visit

        CREATE TABLE IF NOT EXISTS req_visit(
                    id_visit INTEGER,
                    id_request INTEGER
                )

        CREATE INDEX i3 ON req_visit(id_visit)

        CREATE INDEX i4 ON req_visit(id_request)
    |sql} syntax_off]

phstrauss avatar Jul 08 '22 05:07 phstrauss