mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
tutorials: blog: use db.create_table()
This commit is contained in:
parent
f4566bb324
commit
89838f2e21
3 changed files with 12 additions and 9 deletions
|
@ -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() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue