示例#1
0
        /// <summary>
        /// Runs once to Initially create database and fill it with initial data.
        /// </summary>
        public static SQLite_DB CreateDB(this SQLite_DB db)
        {
            db.CreateTable(Tables.Refreshments, "id INTEGER PRIMARY KEY AUTOINCREMENT ,nameof VARCHAR(50) NOT NULL, price INTEGER NOT NULL");
            db.CreateTable(Tables.Ingredients, "id INTEGER PRIMARY KEY AUTOINCREMENT ,nameof VARCHAR(50) NOT NULL, price INTEGER NOT NULL");
            db.CreateTable(Tables.Burgers, "id INTEGER PRIMARY KEY AUTOINCREMENT ,nameof VARCHAR(50) NOT NULL");
            db.CreateTable(Tables.Compositions, "id INTEGER PRIMARY KEY AUTOINCREMENT, ingredient_id INTEGER NOT NULL, burger_id INTEGER NOT NULL, FOREIGN KEY(burger_id) REFERENCES Burgers(id), FOREIGN KEY(ingredient_id) REFERENCES Ingredients(id)");

            db.SeedData(Tables.Ingredients, "\'bułka przenna 100g\', 300");
            db.SeedData(Tables.Ingredients, "\'bułka razowa 100g\', 500");
            db.SeedData(Tables.Ingredients, "\'mięso wołowe 180g\', 600");
            db.SeedData(Tables.Ingredients, "\'mięso drobiowe 180g\', 500");
            db.SeedData(Tables.Ingredients, "\'mięso wieprzowe 180g\', 500");
            db.SeedData(Tables.Ingredients, "\'zestaw sałat 30g\', 300");
            db.SeedData(Tables.Ingredients, "\'jajko sadzone 1szt\', 200");
            db.SeedData(Tables.Ingredients, "\'boczek 50g\', 300");
            db.SeedData(Tables.Ingredients, "\'ser żółty 100g\', 300");
            db.SeedData(Tables.Ingredients, "\'ketchup\', 100");
            db.SeedData(Tables.Ingredients, "\'ser biały 75g\', 200");
            db.SeedData(Tables.Ingredients, "\'krewetki 50g\', 400");
            db.SeedData(Tables.Ingredients, "\'zapiekane bakłażany 80g\', 200");
            db.SeedData(Tables.Ingredients, "\'płatki złota 1g\', 50000");
            db.SeedData(Tables.Ingredients, "\'trufle 10g\', 3500");
            db.SeedData(Tables.Ingredients, "\'masło orzechowe 35g\', 200");
            db.SeedData(Tables.Ingredients, "\'powidła śliwkowe 50g\', 200");

            db.SeedData(Tables.Refreshments, "\'woda 200ml\', 400");
            db.SeedData(Tables.Refreshments, "\'kawa 200ml\', 500");
            db.SeedData(Tables.Refreshments, "\'herbata 200ml\', 300");
            db.SeedData(Tables.Refreshments, "\'Pepsi 200ml\', 600");

            db.SeedData(Tables.Burgers, "\'Mario\'");
            db.SeedData(Tables.Burgers, "\'Luigi\'");
            db.SeedData(Tables.Burgers, "\'Space Invader\'");
            db.SeedData(Tables.Burgers, "\'Contra\'");
            db.SeedData(Tables.Burgers, "\'Robin Hood\'");
            db.SeedData(Tables.Burgers, "\'Dizzy\'");
            db.SeedData(Tables.Burgers, "\'Tanks\'");

            db.SeedData(Tables.Compositions, "3,1");
            db.SeedData(Tables.Compositions, "4,1");
            db.SeedData(Tables.Compositions, "6,1");
            db.SeedData(Tables.Compositions, "10,1");
            db.SeedData(Tables.Compositions, "4,2");
            db.SeedData(Tables.Compositions, "6,2");
            db.SeedData(Tables.Compositions, "5,2");
            db.SeedData(Tables.Compositions, "3,3");
            db.SeedData(Tables.Compositions, "4,3");
            db.SeedData(Tables.Compositions, "6,3");
            db.SeedData(Tables.Compositions, "10,4");
            db.SeedData(Tables.Compositions, "9,4");
            db.SeedData(Tables.Compositions, "11,4");
            db.SeedData(Tables.Compositions, "12,4");
            db.SeedData(Tables.Compositions, "3,5");
            db.SeedData(Tables.Compositions, "4,5");
            db.SeedData(Tables.Compositions, "6,5");
            db.SeedData(Tables.Compositions, "10,6");
            db.SeedData(Tables.Compositions, "4,6");
            db.SeedData(Tables.Compositions, "6,6");
            db.SeedData(Tables.Compositions, "5,6");
            db.SeedData(Tables.Compositions, "3,7");
            db.SeedData(Tables.Compositions, "4,7");
            db.SeedData(Tables.Compositions, "6,7");

            return(db);
        }
示例#2
0
        /// <summary>
        /// Safeplug to rize db file if ever neccessary.
        /// </summary>
        /// <param name="db">Extension method</param>
        /// <returns></returns>
        public static SQLite_DB Rize(this SQLite_DB db)
        {
            File.Delete("./SqliteDB.db");

            return(db);
        }