most Objects done
This commit is contained in:
@@ -45,7 +45,7 @@ public class Database {
|
||||
* creates the initial structure of the db
|
||||
*/
|
||||
protected static void createDb(){
|
||||
String[] sql = new String[14];
|
||||
String[] sql = new String[15];
|
||||
sql[0] = """
|
||||
CREATE TABLE IF NOT EXISTS address (
|
||||
id integer PRIMARY KEY,
|
||||
@@ -157,6 +157,11 @@ public class Database {
|
||||
FOREIGN KEY(food_planid) REFERENCES food_plan(id),
|
||||
FOREIGN KEY(foodid) REFERENCES food(id)
|
||||
);""";
|
||||
sql[14] = """
|
||||
CREATE TABLE IF NOT EXISTS price (
|
||||
id integer PRIMARY KEY,
|
||||
price integer
|
||||
);""";
|
||||
try(Connection conn = connect(); Statement stmt = conn.createStatement()){
|
||||
for(int i = 0; i < sql.length; i++){
|
||||
stmt.execute(sql[i]);
|
||||
@@ -255,6 +260,9 @@ public class Database {
|
||||
sqls.add("""
|
||||
INSERT OR IGNORE INTO severity (id,name)
|
||||
VALUES('3','Kritisch');""");
|
||||
sqls.add("""
|
||||
INSERT OR IGNORE INTO price (id,price)
|
||||
VALUES('1','500');""");
|
||||
try(Connection conn = connect(); Statement stmt = conn.createStatement()){
|
||||
for (String sql : sqls) {
|
||||
stmt.execute(sql);
|
||||
|
Reference in New Issue
Block a user