fix new installs
This commit is contained in:
parent
b9a8c91868
commit
ff58cd9295
1 changed files with 17 additions and 0 deletions
17
oml/setup.py
17
oml/setup.py
|
@ -454,6 +454,23 @@ def upgrade_db(old, new=None):
|
||||||
sql = 'CREATE UNIQUE INDEX IF NOT EXISTS useritem_index on useritem(user_id,item_id)'
|
sql = 'CREATE UNIQUE INDEX IF NOT EXISTS useritem_index on useritem(user_id,item_id)'
|
||||||
session.execute(sql)
|
session.execute(sql)
|
||||||
session.commit()
|
session.commit()
|
||||||
|
if old <= '20160111-603-90648f9' and not new:
|
||||||
|
run_sql('ALTER TABLE sort ADD categories VARCHAR(1000)')
|
||||||
|
run_sql('ALTER TABLE sort ADD series VARCHAR(1000)')
|
||||||
|
run_sql('CREATE INDEX ix_sort_categories ON sort (categories)')
|
||||||
|
run_sql('''CREATE TABLE user_metadata (
|
||||||
|
created DATETIME,
|
||||||
|
modified DATETIME,
|
||||||
|
id INTEGER NOT NULL,
|
||||||
|
item_id VARCHAR(32),
|
||||||
|
user_id VARCHAR(43),
|
||||||
|
data_hash VARCHAR(40),
|
||||||
|
data BLOB,
|
||||||
|
PRIMARY KEY (id),
|
||||||
|
FOREIGN KEY(user_id) REFERENCES user (id)
|
||||||
|
)''')
|
||||||
|
run_sql('CREATE UNIQUE INDEX IF NOT EXISTS user_metadata_index ON user_metadata(id, user_id)')
|
||||||
|
run_sql('CREATE INDEX ix_user_metadata_data_hash ON user_metadata (data_hash)')
|
||||||
|
|
||||||
def create_default_lists(user_id=None):
|
def create_default_lists(user_id=None):
|
||||||
with db.session():
|
with db.session():
|
||||||
|
|
Loading…
Reference in a new issue