Example #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);
        }
        public void Creates_table_with_string_id()
        {
            // The Guitar test object has a string field named simply SKU. This will not be matched
            // without an attribute decoration, and horrible plague and pesilence will result.

            _db.TryDropTable("guitardocuments");
            var  guitarstore = new PgDocumentStore <GuitarDocuments>(_db);
            bool exists      = _db.TableExists(guitarstore.TableName);

            Assert.IsTrue(exists);
        }
Example #3
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);
        }
Example #4
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);
        }
Example #7
0
        public void Creates_table_with_int_id()
        {
            // The Widget test object has an int field named Identifier. This will not be matched
            // without an attribute decoration, and horrible plague and pesilence will result. Also,
            // the attribute IsAuto property is set to false, so the field will NOT be a serial key.

            _db.TryDropTable("widgetdocuments");
            var  widgetstore = new PgDocumentStore <WidgetDocuments>(_db);
            bool exists      = _db.TableExists(widgetstore.TableName);

            Assert.IsTrue(exists);
        }
Example #8
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);
            }
        }
Example #9
0
        public void Creates_table_with_string_id()
        {
            // The Instrument test object has an int field named simply Id. Without any
            // Attribute decoration, this should result in a table with a serial int PK.

            // NOTE: Gotta go look to see if the field is a serial in or not...
            //var db = new CommandRunner("chinook");
            _db.TryDropTable("instrumentdocuments");
            var  InstrumentStore = new PgDocumentStore <InstrumentDocuments>(_db);
            bool exists          = _db.TableExists(InstrumentStore.TableName);

            Assert.IsTrue(exists);
        }
Example #10
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);
    }
 public void init()
 {
     _db = new PgDbCore("biggy_test");
     _db.TryDropTable("propertydocuments");
     _PropertyDocumentStore = _db.CreateDocumentStoreFor <PropertyDocument>();
 }
 public void init() {
   _db = new PgDbCore("biggy_test");
   _db.TryDropTable("propertydocuments");
   _PropertyDocumentStore = _db.CreateDocumentStoreFor<PropertyDocument>();
 }