Fixed delete device and merged changes
This commit is contained in:
@@ -73,6 +73,13 @@ def init_db(app=None):
|
||||
)
|
||||
''')
|
||||
cursor.execute('''
|
||||
CREATE TABLE IF NOT EXISTS DeviceType (
|
||||
id INTEGER PRIMARY KEY AUTO_INCREMENT,
|
||||
name VARCHAR(255) NOT NULL UNIQUE,
|
||||
icon_class VARCHAR(255) NOT NULL
|
||||
)
|
||||
''')
|
||||
cursor.execute('''
|
||||
CREATE TABLE IF NOT EXISTS Device (
|
||||
id INTEGER PRIMARY KEY AUTO_INCREMENT,
|
||||
name VARCHAR(255) NOT NULL,
|
||||
@@ -100,13 +107,6 @@ def init_db(app=None):
|
||||
FOREIGN KEY (subnet_id) REFERENCES Subnet(id) ON DELETE CASCADE
|
||||
)
|
||||
''')
|
||||
cursor.execute('''
|
||||
CREATE TABLE IF NOT EXISTS DeviceType (
|
||||
id INTEGER PRIMARY KEY AUTO_INCREMENT,
|
||||
name VARCHAR(255) NOT NULL UNIQUE,
|
||||
icon_class VARCHAR(255) NOT NULL
|
||||
)
|
||||
''')
|
||||
cursor.execute('SELECT COUNT(*) FROM DeviceType')
|
||||
if cursor.fetchone()[0] == 0:
|
||||
cursor.executemany('INSERT INTO DeviceType (name, icon_class) VALUES (%s, %s)', [
|
||||
|
||||
Reference in New Issue
Block a user