Suppression du blog par les post-it
This commit is contained in:
21
tools/databaseinit.py
Normal file → Executable file
21
tools/databaseinit.py
Normal file → Executable file
@@ -1,27 +1,29 @@
|
||||
#!venv/bin/python
|
||||
|
||||
import sqlite3
|
||||
import sqlite3
|
||||
import os.path
|
||||
|
||||
def init_db():
|
||||
if os.path.isfile('base.db'):
|
||||
return False
|
||||
else:
|
||||
else:
|
||||
conn = sqlite3.connect('base.db')
|
||||
cursor = conn.cursor()
|
||||
cursor.execute("""
|
||||
CREATE TABLE IF NOT EXISTS users(
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE,
|
||||
Mail CHAR(80) PRIMARY KEY UNIQUE NOT NULL,
|
||||
name TEXT,
|
||||
mail TEXT,
|
||||
alias TEXT,
|
||||
xmpp TEXT,
|
||||
passwd TEXT,
|
||||
avatar TEXT,
|
||||
nom, TEXT,
|
||||
nom TEXT,
|
||||
prenom TEXT,
|
||||
age TEXT,
|
||||
profession TEXT
|
||||
)
|
||||
""")
|
||||
website TEXT,
|
||||
Token CHAR(30),
|
||||
Mail_rescue TEXT )
|
||||
""")
|
||||
conn.commit()
|
||||
print ('table users OK')
|
||||
|
||||
@@ -40,10 +42,9 @@ def init_db():
|
||||
conn.close()
|
||||
print ('table posts OK')
|
||||
return True
|
||||
|
||||
|
||||
def init_dir():
|
||||
if os.path.isdir('users'):
|
||||
return False
|
||||
else:
|
||||
os.makedirs('./users/')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user