Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

schema creation and semicolon #25

Open
phstrauss opened this issue Jul 8, 2022 · 0 comments
Open

schema creation and semicolon #25

phstrauss opened this issue Jul 8, 2022 · 0 comments

Comments

@phstrauss
Copy link

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]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant