Fix createdb and config filename.
This commit is contained in:
parent
da1876f7d0
commit
3af3de2ea3
2 changed files with 9 additions and 9 deletions
18
createdb.nim
18
createdb.nim
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import strutils, db_sqlite
|
||||
|
||||
var db = Open(connection="nimforum.db", user="postgres", password="",
|
||||
var db = open(connection="nimforum.db", user="postgres", password="",
|
||||
database="nimforum")
|
||||
|
||||
const
|
||||
|
|
@ -16,7 +16,7 @@ const
|
|||
TPassword = "varchar(32)"
|
||||
TEmail = "varchar(30)"
|
||||
|
||||
db.Exec(sql"""
|
||||
db.exec(sql"""
|
||||
create table if not exists thread(
|
||||
id integer primary key,
|
||||
name varchar(100) not null,
|
||||
|
|
@ -24,11 +24,11 @@ create table if not exists thread(
|
|||
modified timestamp not null default (DATETIME('now'))
|
||||
);""", [])
|
||||
|
||||
db.Exec(sql"""
|
||||
db.exec(sql"""
|
||||
create unique index if not exists ThreadNameIx on thread (name);
|
||||
""", [])
|
||||
|
||||
db.Exec(sql("""
|
||||
db.exec(sql("""
|
||||
create table if not exists person(
|
||||
id integer primary key,
|
||||
name $# not null,
|
||||
|
|
@ -42,14 +42,14 @@ create table if not exists person(
|
|||
);""" % [TUserName, TPassword, TEmail]), [])
|
||||
# echo "person table already exists"
|
||||
|
||||
db.Exec(sql"""
|
||||
db.exec(sql"""
|
||||
create unique index if not exists UserNameIx on person (name);
|
||||
""", [])
|
||||
|
||||
# ----------------------- Forum ------------------------------------------------
|
||||
|
||||
|
||||
if not db.TryExec(sql"""
|
||||
if not db.tryExec(sql"""
|
||||
create table if not exists post(
|
||||
id integer primary key,
|
||||
author integer not null,
|
||||
|
|
@ -66,7 +66,7 @@ create table if not exists post(
|
|||
|
||||
# -------------------- Session -------------------------------------------------
|
||||
|
||||
if not db.TryExec(sql("""
|
||||
if not db.tryExec(sql("""
|
||||
create table if not exists session(
|
||||
id integer primary key,
|
||||
ip inet not null,
|
||||
|
|
@ -77,7 +77,7 @@ create table if not exists session(
|
|||
);""" % [TPassword]), []):
|
||||
echo "session table already exists"
|
||||
|
||||
if not db.TryExec(sql"""
|
||||
if not db.tryExec(sql"""
|
||||
create table if not exists antibot(
|
||||
id integer primary key,
|
||||
ip inet not null,
|
||||
|
|
@ -88,6 +88,6 @@ create table if not exists antibot(
|
|||
|
||||
#discard stdin.readline()
|
||||
|
||||
Close(db)
|
||||
close(db)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue