1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

tutorials: blog: use db.create_table()

This commit is contained in:
Alexander Medvednikov
2021-04-06 22:15:14 +03:00
parent f4566bb324
commit 89838f2e21
3 changed files with 12 additions and 9 deletions

View File

@ -33,8 +33,11 @@ pub fn (app &App) index() vweb.Result {
pub fn (mut app App) init_once() {
app.db = sqlite.connect('blog.db') or { panic(err) }
app.db.exec('create table if not exists article (' + 'id integer primary key, ' +
"title text default ''," + "text text default ''" + ');')
app.db.create_table('article', [
'id integer primary key',
"title text default ''",
"text text default ''",
])
}
pub fn (mut app App) init() {