new file: .env
new file: bot.db new file: db/db.go new file: go.mod new file: go.sum new file: handlers/dashboard.go new file: handlers/webhook.go new file: main.go new file: services/openrouter.go new file: services/whatsapp.go new file: templates/dashboard.html new file: types/types.go
This commit is contained in:
33
db/db.go
Normal file
33
db/db.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package db
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
|
||||
_ "modernc.org/sqlite"
|
||||
)
|
||||
|
||||
var Conn *sql.DB
|
||||
|
||||
func Init() {
|
||||
var err error
|
||||
Conn, err = sql.Open("sqlite", "./bot.db")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
schema := `
|
||||
CREATE TABLE IF NOT EXISTS clients (
|
||||
id TEXT PRIMARY KEY,
|
||||
name TEXT,
|
||||
tier TEXT,
|
||||
msg_count INTEGER DEFAULT 0
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS appointments (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
client_id TEXT,
|
||||
customer_phone TEXT,
|
||||
appointment_date TEXT,
|
||||
status TEXT DEFAULT 'confirmed'
|
||||
);`
|
||||
Conn.Exec(schema)
|
||||
}
|
||||
Reference in New Issue
Block a user