{"id":22394156,"url":"https://github.com/atlantis-software/offshore-sql","last_synced_at":"2025-07-31T10:32:33.380Z","repository":{"id":27173838,"uuid":"30643531","full_name":"Atlantis-Software/offshore-sql","owner":"Atlantis-Software","description":"a sql adapter based on knex for offshore","archived":false,"fork":false,"pushed_at":"2020-12-30T10:24:56.000Z","size":205,"stargazers_count":7,"open_issues_count":2,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-02T05:22:20.646Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Atlantis-Software.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"License","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-02-11T10:52:39.000Z","updated_at":"2021-12-16T22:16:03.000Z","dependencies_parsed_at":"2022-09-20T23:21:20.618Z","dependency_job_id":null,"html_url":"https://github.com/Atlantis-Software/offshore-sql","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Atlantis-Software%2Foffshore-sql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Atlantis-Software%2Foffshore-sql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Atlantis-Software%2Foffshore-sql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Atlantis-Software%2Foffshore-sql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Atlantis-Software","download_url":"https://codeload.github.com/Atlantis-Software/offshore-sql/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228236599,"owners_count":17889563,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-05T05:09:12.795Z","updated_at":"2024-12-05T05:09:30.149Z","avatar_url":"https://github.com/Atlantis-Software.png","language":"JavaScript","readme":"# offshore-sql\n\nOffshore-sql is an adapter for sql databases, created for [Offshore](https://github.com/Atlantis-Software/offshore)\n\n[![npm version](https://badge.fury.io/js/offshore-sql.svg)](https://www.npmjs.com/offshore-sql)\n[![Build Status](https://travis-ci.org/Atlantis-Software/offshore-sql.svg?branch=master)](https://travis-ci.org/Atlantis-Software/offshore-sql)\n[![Coverage Status](https://coveralls.io/repos/github/Atlantis-Software/offshore-sql/badge.svg?branch=master)](https://coveralls.io/github/Atlantis-Software/offshore-sql?branch=master)\n[![Dependencies Status](https://david-dm.org/Atlantis-Software/offshore-sql.svg)](https://david-dm.org/Atlantis-Software/offshore-sql)\n\n\n\n\n\n## Installation\n\n### Install from NPM.\n\n```bash\n$ npm install offshore-sql\n```\n### Install the database driver\n\n#### for mysql\n```bash\n$ npm install mysql --save\n```\n#### for mariadb\n```bash\n$ npm install mariasql --save\n```\n#### for sqlite3\n```bash\n$ npm install sqlite3 --save\n```\n#### for postgres\n```bash\n$ npm install pg --save\n```\n#### for Oracle\n\nThis package require installing the oracle instant client and instant client devel downloadable at url :\n\nhttp://www.oracle.com/technetwork/database/features/instant-client/index-097480.html\n\nfor rpm linux :\n\n```bash\n$ su -\n# yum localinstall oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm\n# yum localinstall oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm\n# exit\n$ vi ~/.bash_profile\n```\n\nadd the following lines :\n\n```bash\nexport OCI_LIB_DIR=/usr/lib/oracle/12.1/client64/lib/\nexport OCI_INCLUDE_DIR=/usr/include/oracle/12.1/client64/\nexport OCI_VERSION=12\nexport ORACLE_HOME=/usr/lib/oracle/12.1/client64\nexport PATH=$PATH:$ORACLE_HOME/bin\nexport LD_LIBRARY_PATH=$ORACLE_HOME/lib\n```\n\nsave and exit, then :\n\n```bash\n$ source ~/.bash_profile\n$ npm install oracledb --save\n```\n\n## Offshore-sql Configuration\n\nConnections are defined by the following attributes :\n\nProperty | Value | Description\n:---: | :---: | ---\n`dbType` | `string` | Database type (`mysql`, `mariadb`, `sqlite3`, `postgres`, `oracle`).\n`host` | `string` | Database server host address.\n`port` | `integer` | Database server port.\n`user` | `string` | Database user.\n`password` | `string` | Database user password.\n`database` | `string` | Database name.\n`adapter` | `string` | Adapter used by this connection. It must correspond to one of the `adapters` defined before.\n\n```javascript\nvar Offshore = require('offshore');\nvar Adapter = require('offshore-sql');\n\nvar offshore = new Offshore();\n\n// Define configuration\nvar config = {\n  adapters: {\n    // Here we define an adapter name and assign it our adapter module\n    'offshoreAdapter': Adapter\n  },\n  connections: {\n    mySqlConnection: {\n      // adapter is a reference to the adapter name defined above\n      adapter: 'offshoreAdapter',\n      host: '127.0.0.1',\n      port: 13306,\n      user: 'root',\n      password: 'itsSecret',\n      database: 'offshoreSql',\n      dbType: 'mysql'\n    }\n  }\n};\n\n// Extend the collections\nvar User = Offshore.Collection.extend({\n  tableName: 'userTable',\n  identity: 'user',\n  connection: 'mySqlConnection', // Our connection is assigned here\n  migrate: 'alter',\n  attributes: {\n    id: {\n      columnName: 'ID',\n      type: 'integer',\n      primaryKey: true,\n      unique: true,\n      autoIncrement: true\n    },\n    name: {\n      columnName: \"NAME\",\n      type: 'string'\n    }\n  }\n});\n\n// Load the collections\noffshore.loadCollection(User);\n\n// Offshore initialization with the config object\noffshore.initialize(config, function(err, ontology) {\n  \n  User = ontology.collections.user;\n  // We can now query our model\n  // https://github.com/Atlantis-Software/offshore-docs/blob/master/queries/query-methods.md\n});\n```\n\n#### License\n\n**[MIT](./LICENSE)**\n\u0026copy; 2016\n[Atlantis Software](http://www.atlantis-software.net/) \u0026 contributors\n\n[offshore](https://github.com/Atlantis-Software/offshore/) is free and open-source under the [MIT License](https://opensource.org/licenses/MIT/).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatlantis-software%2Foffshore-sql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatlantis-software%2Foffshore-sql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatlantis-software%2Foffshore-sql/lists"}