Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added postgres storage for botbuilder #383

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions libraries/botbuilder-storage-pg/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next

lib/

test/
2 changes: 2 additions & 0 deletions libraries/botbuilder-storage-pg/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
test/
30 changes: 30 additions & 0 deletions libraries/botbuilder-storage-pg/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Bot Builder PostgreSQL Storage

This is a simple storage adapter for PostgreSQL.

## Installation

```powershell
npm install @botbuildercommunity/storage-pg --save
```

## Usage

```typescript
import { PostgreSQLStorage } from '@botbuildercommunity/storage-pg';

const storage = new PostgreSQLStorage({
user: <DATABASE_USERNAME>,
password: <DATABASE_PASSWORD>,
server: <DATABASE_SERVER>,
database: <DATABASE_NAME>,
table: <DATABASE_TABLE>
});

const conversationState = new ConversationState(storage);
const userState = new UserState(storage);
```

> This module uses the [node-pg](https://www.npmjs.com/package/pg) package for SQL connectivity. The `PostgreSQLOptions` that is passed to the `PostgreSQLStorage` object extends the `config` object of that package. All options from that `config` option can be passed in.

> This module assumes two columns in your database table: `id` with datatype `VARCHAR(255)` and `data` with `JSONB` respectively.
Loading
Loading