無駄なかっことじを削除

This commit is contained in:
suti7yk5032 2024-08-23 00:34:07 +09:00
parent 829184a91a
commit ee4113f95d

View file

@ -81,14 +81,14 @@ class DL():
find_club_member_table = cursor.fetchall() find_club_member_table = cursor.fetchall()
print(find_club_member_table) print(find_club_member_table)
if find_club_member_table[0][0] == False: if find_club_member_table[0][0] == False:
cursor.execute("CREATE TABLE club_member (member_id SERIAL NOT NULL, name TEXT NOT NULL, discord_user_name TEXT NOT NULL, discord_user_id TEXT NOT NULL, PRIMARY KEY (member_id))") cursor.execute("CREATE TABLE club_member (member_id SERIAL NOT NULL, name TEXT NOT NULL, discord_user_name TEXT NOT NULL, discord_user_id TEXT NOT NULL, PRIMARY KEY (member_id)")
self.db.commit() self.db.commit()
cursor.execute("SELECT EXISTS (SELECT FROM information_schema.tables WHERE table_schema = 'public' AND table_name = 'pc_list')") cursor.execute("SELECT EXISTS (SELECT FROM information_schema.tables WHERE table_schema = 'public' AND table_name = 'pc_list')")
find_pc_list_table = cursor.fetchall() find_pc_list_table = cursor.fetchall()
print(find_pc_list_table) print(find_pc_list_table)
if find_pc_list_table[0][0] == False: if find_pc_list_table[0][0] == False:
cursor.execute("CREATE TABLE pc_list (pc_number INTEGER NOT NULL, using_member_id INTEGER, password_hash VARCHAR(32), PRIMARY KEY (pc_number), FOREIGN KEY (using_member_id) REFERENCES club_member(member_id))") cursor.execute("CREATE TABLE pc_list (pc_number INTEGER NOT NULL, using_member_id INTEGER, password_hash VARCHAR(32), PRIMARY KEY (pc_number), FOREIGN KEY (using_member_id) REFERENCES club_member(member_id)")
for i in self.pc_list: for i in self.pc_list:
print(i) print(i)
cursor.execute("INSERT INTO pc_list (pc_number) VALUES (%s)", (i,)) cursor.execute("INSERT INTO pc_list (pc_number) VALUES (%s)", (i,))
@ -98,7 +98,7 @@ class DL():
find_keyboard_list_table = cursor.fetchall() find_keyboard_list_table = cursor.fetchall()
print(find_keyboard_list_table) print(find_keyboard_list_table)
if find_keyboard_list_table[0][0] == False: if find_keyboard_list_table[0][0] == False:
cursor.execute("CREATE TABLE keyboard_list (keyboard_number INTEGER NOT NULL, using_member_id INTEGER, PRIMARY KEY (keyboard_number), FOREIGN KEY (using_member_id) REFERENCES club_member(member_id))") cursor.execute("CREATE TABLE keyboard_list (keyboard_number INTEGER NOT NULL, using_member_id INTEGER, PRIMARY KEY (keyboard_number), FOREIGN KEY (using_member_id) REFERENCES club_member(member_id)")
for i in self.keyboard_list: for i in self.keyboard_list:
print(i) print(i)
cursor.execute("INSERT INTO keyboard_list (keyboard_number) VALUES (%s)", (i,)) cursor.execute("INSERT INTO keyboard_list (keyboard_number) VALUES (%s)", (i,))
@ -108,7 +108,7 @@ class DL():
find_mouse_list_table = cursor.fetchall() find_mouse_list_table = cursor.fetchall()
print(find_mouse_list_table) print(find_mouse_list_table)
if find_mouse_list_table[0][0] == False: if find_mouse_list_table[0][0] == False:
cursor.execute("CREATE TABLE mouse_list (mouse_number INTEGER NOT NULL, using_member_id INTEGER, PRIMARY KEY (mouse_number), FOREIGN KEY (using_member_id) REFERENCES club_member(member_id))") cursor.execute("CREATE TABLE mouse_list (mouse_number INTEGER NOT NULL, using_member_id INTEGER, PRIMARY KEY (mouse_number), FOREIGN KEY (using_member_id) REFERENCES club_member(member_id)")
for i in self.mouse_list: for i in self.mouse_list:
print(i) print(i)
cursor.execute("INSERT INTO mouse_list (mouse_number) VALUES (%s)", (i,)) cursor.execute("INSERT INTO mouse_list (mouse_number) VALUES (%s)", (i,))