Ejemplo n.º 1
0
        private void DropCreateTestTables()
        {
            IDbCore _db = new PgDbCore("biggy_test");
            string  propertyTableSql = ""
                                       + "CREATE TABLE \"Property\" ( \"Id\" serial NOT NULL, \"Name\" text, \"Address\" text, CONSTRAINT pk_property_id PRIMARY KEY (\"Id\"));";

            string BuildingTableSql = ""
                                      + "CREATE TABLE \"Building\" ( \"BIN\" text NOT NULL, \"Identifier\" text, \"PropertyId\" text, CONSTRAINT pk_building_bin PRIMARY KEY (\"BIN\"));";

            string WorkOrderTableSql = ""
                                       + "CREATE TABLE \"wk_order\" ( \"wo_id\" serial NOT NULL, \"desc\" text, CONSTRAINT pk_wk_order_wo_id PRIMARY KEY (\"wo_id\"));";

            string UnitTableSql = ""
                                  + "CREATE TABLE \"unit\" ( \"unit_id\" serial NOT NULL, \"BIN\" text, \"unit_no\" text, CONSTRAINT pk_unit_unit_id PRIMARY KEY (\"unit_id\"));";

            _db.TryDropTable("Property");
            _db.TryDropTable("Building");
            _db.TryDropTable("wk_order");
            _db.TryDropTable("unit");

            _db.TransactDDL(UnitTableSql);
            _db.TransactDDL(propertyTableSql);
            _db.TransactDDL(BuildingTableSql);
            _db.TransactDDL(WorkOrderTableSql);
        }
Ejemplo n.º 2
0
        void DropCreateTestTables()
        {
            string UnitTableSql = ""
                                  + "CREATE TABLE \"unit\" ( \"unit_id\" serial NOT NULL, \"BIN\" text, \"unit_no\" text, CONSTRAINT pk_unit_unit_id PRIMARY KEY (\"unit_id\"))";

            _db.TryDropTable("unit");
            _db.TransactDDL(UnitTableSql);
        }
        private void DropCreateTestTables()
        {
            string WorkOrderTableSql = ""
                                       + "CREATE TABLE \"wk_order\" ( \"wo_id\" serial NOT NULL, \"desc\" text, CONSTRAINT pk_wk_order_wo_id PRIMARY KEY (\"wo_id\"))";

            _db.TryDropTable("wk_order");
            _db.TransactDDL(WorkOrderTableSql);
        }
        private void DropCreateTestTables()
        {
            string propertyTableSql = ""
                                      + "CREATE TABLE \"Property\" ( \"Id\" serial NOT NULL, \"Name\" text, \"Address\" text, CONSTRAINT pk_property_id PRIMARY KEY (\"Id\"))";

            _db.TryDropTable("Property");
            _db.TransactDDL(propertyTableSql);
        }
Ejemplo n.º 5
0
        void DropCreateTestTables()
        {
            string BuildingTableSql = ""
                                      + "CREATE TABLE \"Building\" ( \"BIN\" text NOT NULL, \"Identifier\" text, \"PropertyId\" text, CONSTRAINT pk_building_bin PRIMARY KEY (\"BIN\"))";

            _db.TryDropTable("Building");
            if (!_db.TableExists("Building"))
            {
                _db.TransactDDL(BuildingTableSql);
            }
        }
Ejemplo n.º 6
0
    private void DropCreateTestTables() {
      IDbCore _db = new PgDbCore("biggy_test");
      string propertyTableSql = ""
        + "CREATE TABLE \"Property\" ( \"Id\" serial NOT NULL, \"Name\" text, \"Address\" text, CONSTRAINT pk_property_id PRIMARY KEY (\"Id\"));";

      string BuildingTableSql = ""
        + "CREATE TABLE \"Building\" ( \"BIN\" text NOT NULL, \"Identifier\" text, \"PropertyId\" text, CONSTRAINT pk_building_bin PRIMARY KEY (\"BIN\"));";

      string WorkOrderTableSql = ""
        + "CREATE TABLE \"wk_order\" ( \"wo_id\" serial NOT NULL, \"desc\" text, CONSTRAINT pk_wk_order_wo_id PRIMARY KEY (\"wo_id\"));";

      string UnitTableSql = ""
        + "CREATE TABLE \"unit\" ( \"unit_id\" serial NOT NULL, \"BIN\" text, \"unit_no\" text, CONSTRAINT pk_unit_unit_id PRIMARY KEY (\"unit_id\"));";

      _db.TryDropTable("Property");
      _db.TryDropTable("Building");
      _db.TryDropTable("wk_order");
      _db.TryDropTable("unit");

      _db.TransactDDL(UnitTableSql);
      _db.TransactDDL(propertyTableSql);
      _db.TransactDDL(BuildingTableSql);
      _db.TransactDDL(WorkOrderTableSql);
    }
Ejemplo n.º 7
0
        public override void DropCreateAll()
        {
            const string SQL_TRACKS_TABLE = ""
                                            + "CREATE TABLE track ( track_id SERIAL PRIMARY KEY, album_id INTEGER NOT NULL, name text NOT NULL, composer TEXT );";
            const string SQL_ARTISTS_TABLE = ""
                                             + "CREATE TABLE artist ( artist_id SERIAL PRIMARY KEY NOT NULL, name text NOT NULL );";
            const string SQL_ALBUMS_TABLE = ""
                                            + "CREATE TABLE album ( album_id SERIAL PRIMARY KEY NOT NULL, artist_id integer NOT NULL, title text NOT NULL );";

            _db.TryDropTable("artist");
            _db.TryDropTable("album");
            _db.TryDropTable("track");
            _db.TryDropTable("artistdocuments");

            int result = _db.TransactDDL(SQL_ARTISTS_TABLE + SQL_ALBUMS_TABLE + SQL_TRACKS_TABLE);
        }