Rename table module to schema module
This commit is contained in:
parent
3184e5d6fa
commit
c41a492b07
2 changed files with 12 additions and 2 deletions
|
@ -1,10 +1,10 @@
|
|||
import loop.tables as tables
|
||||
import loop.schema as schema
|
||||
import loop.habits as habits
|
||||
import loop.repetitions as rep
|
||||
|
||||
|
||||
def migrate(trackers, events):
|
||||
db = tables.migrate("output.db")
|
||||
db = schema.migrate("output.db")
|
||||
if trackers is not None:
|
||||
|
||||
habitlist = habits.migrate(db, trackers)
|
||||
|
|
|
@ -55,7 +55,17 @@ def create_tables(db):
|
|||
)
|
||||
|
||||
|
||||
def create_constraints(db):
|
||||
c = db.cursor()
|
||||
c.execute(
|
||||
""" CREATE UNIQUE INDEX IF NOT EXISTS idx_repetitions_habit_timestamp
|
||||
on Repetitions( habit, timestamp);
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def migrate(name):
|
||||
db = create_database(name)
|
||||
create_tables(db)
|
||||
create_constraints(db)
|
||||
return db
|
Loading…
Reference in a new issue