Skip to content

Repository files navigation

filer-sql

Support for MySQL, MariaDB, SQLite or PostgreSQL Filer providers.

Usage

The SQLProvider can be used with Filer on node.js (i.e., this won't work in browser) like so:

// Option 1 - connecting with a connection URLvarprovider1=newSQLProvider({// The db type to use, see below for other optionstype: SQLProvider.MYSQL,// A MySQL connection stringurl: 'mysql://user:pass@example.com:9821/dbname',// A unique string to identify this user's filesystem (e.g., username)user: 'something-unique'});// Option 2 - connecting with separate db optionsvarprovider2=newSQLProvider({// The db type to use, see below for other optionstype: SQLProvider.MYSQL,// If you want SQL debug logging, pass a logging function//logging: console.log,// A unique string to identify this user's filesystem (e.g., username)user: 'something-unique',// Database optionsdb: {// Name of Database to use, defaults to 'filer'name: "name",// DB authentication info, if necessaryusername: "username",password: "password"}});varfs=newFiler.FileSystem({provider: provider2});

Database Types

The type of database can be one of:

  • SQLProvider.MYSQL
  • SQLProvider.SQLITE
  • SQLProvider.POSTGRES
  • SQLProvider.MARIADB

NOTE: some database types require you to pre-create your database. The default database name is filer unless you specify something else.

Database Options

If you want to pass extra options to Sequelize, add them to the options object. See the list of valid options.

Database Schema

The database will have a single table, named filer_data with the following columns:

NameTypeDetails
userSTRING(20) Primary KeyUnique username for this user's filesystem
keySTRING(36) Primary KeyFiler Node ID's of the form '00000000-0000-0000-0000-000000000000'
dataBLOBbinary data with JSON stored as Object->JSON->Buffer(utf8))

About

Support for MySQL, MariaDB, SQLite or PostgreSQL Filer providers

Resources

Stars

2 stars

Watchers

4 watching

Forks

Releases

Packages

Used by

Contributors

Languages