Open ghost opened 6 years ago
Just read your blog and found
Interestingly, Ormin's DSL for generating SQL does not cover schema creations. It is assumed that you need to interface to some existing database. Well, that is not true for our example, so here is a short program that runs this script:
To import the model we need the ormin_importer tool:
nim c tools/ormin_importer tools/ormin_importer examples/chat/chat_model.sql
running the importer worked like a charm.
I stand corrected, I must have been using an out-of-date binary.
Even with the importer, I still can't get the project to compile
Ok, well, please attach your "site_model" or a simplified version that has the same problem.
site_model.sql:
CREATE TABLE IF NOT EXISTS feeds (
id INTEGER PRIMARY KEY,
feed_url text NOT NULL
);
site_model.nim:
# Generated by ormin_importer. DO NOT EDIT.
import ormin
type
Attr = object
name: string
tabIndex: int
typ: DbTypekind
key: int # 0 nothing special,
# +1 -- primary key
# -N -- references attribute N
const tableNames = [
"feeds"
]
const attributes = [
Attr(name: "id", tabIndex: 0, typ: dbInt, key: 1),
Attr(name: "feed_url", tabIndex: 0, typ: dbVarchar, key: 0)
]
I'm trying to compile a project using ormin, but I keep getting an error about an unknown selector:
Error: unknown selector: feeds
. The full project is here, and relevant code is as follows:The error is on line 10 of db.nim, which is the
insert feeds("google")
line. I can't figure out what the issue is since I can get this working just fine with regular db_sqlite. Am I doing something wrong?