def creation_tables(): database.execute_sql("SET FOREIGN_KEY_CHECKS=0") if CategoriesProduct.table_exists(): CategoriesProduct.drop_table(cascade=True) if Category.table_exists(): Category.drop_table(cascade=True) if Product.table_exists(): Product.drop_table(cascade=True) if User.table_exists(): User.drop_table(cascade=True) if Store.table_exists(): Store.drop_table(cascade=True) database.execute_sql("SET FOREIGN_KEY_CHECKS=1") User.create_table() Store.create_table() Product.create_table() Category.create_table() CategoriesProduct.create_table()
def create_tables(): auth.User.create_table(fail_silently=True) Users.create_table(fail_silently=True) Role.create_table(fail_silently=True) Category.create_table(fail_silently=True) Product.create_table(fail_silently=True) Period.create_table(fail_silently=True) Order_detail.create_table(fail_silently=True) Address.create_table(fail_silently=True) Show.create_table(fail_silently=True) UserRoles.create_table(fail_silently=True) Configure.create_table(fail_silently=True) WinRecord.create_table(fail_silently=True)
def create_tables(): if Category.table_exists(): Category.drop_table() if Product.table_exists(): Product.drop_table() if Store.table_exists(): Store.drop_table() if User.table_exists(): User.drop_table() User.create_table() Store.create_table() Product.create_table() Category.create_table()
def create_db(): logging.info("Creating SQLite database %s..." % DB_FILE) # Define database db = SqliteDatabase(DB_FILE, threadlocals=True) # Connect to database db.connect() # Create tables Category.create_table() Feed.create_table() Post.create_table() Image.create_table() # Create default Unsorted category Category.create(name='Unsorted', comment='Uncategorised feeds', order=1) logging.info("Database created.")